-
Notifications
You must be signed in to change notification settings - Fork 409
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support colllation for planner refactory test framework #5449
Conversation
[REVIEW NOTIFICATION] This pull request has been approved by:
To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
@xzhangxian1008: GitHub didn't allow me to request PR reviews from the following users: /cc. Note that only pingcap members and repo collaborators can review this PR, and authors cannot review their own PRs. In response to this: Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Others LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
explicit DAGRequestBuilder(size_t & index, Int32 collator = TiDB::ITiDBCollator::UTF8MB4_BIN) | ||
: executor_index(index) | ||
{ | ||
properties.collator = -abs(collator); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use -abs(collator)
instead of just collator
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do we use
-abs(collator)
instead of justcollator
?
collator passed by tidb is negative, so we need to guarantee the collator < 0. See https://github.com/pingcap/tiflash/blob/master/dbms/src/Flash/Coprocessor/DAGUtils.cpp#L1357
dbms/src/TestUtils/mockExecutor.h
Outdated
@@ -101,6 +103,9 @@ class DAGRequestBuilder | |||
DAGRequestBuilder & sort(MockOrderByItem order_by, bool is_partial_sort, uint64_t fine_grained_shuffle_stream_count = 0); | |||
DAGRequestBuilder & sort(MockOrderByItemVec order_by_vec, bool is_partial_sort, uint64_t fine_grained_shuffle_stream_count = 0); | |||
|
|||
void setCollation(Int32 collator_) { properties.collator = -abs(collator_); } |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we can wrap a function for -abs(collator_)
/// add some comments
Int32 inline getXXXCollation(Int32 collator_)
{
return -abs(collator_);
}
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
may be we can wrap a function for
-abs(collator_)
/// add some comments Int32 inline getXXXCollation(Int32 collator_) { return -abs(collator_); }
ok
{ | ||
context.setCollation(collation); | ||
auto request = context.scan(db_name, table_name).aggregation(MockAstVec{}, {col(col_name)}).project({col_name}).build(context); | ||
std::cout << request->DebugString() << std::endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless code?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
useless code?
I will delete it
context.setCollation(collation); | ||
auto request = context.scan(db_name, table_name).aggregation(MockAstVec{}, {col(col_name)}).project({col_name}).build(context); | ||
std::cout << request->DebugString() << std::endl; | ||
ASSERT_COLUMNS_EQ_UR(expect, executeStreams(request, 1)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems executeStreams(reuqest)
is enough.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
seems
executeStreams(reuqest)
is enough.
ok
std::queue<tipb::Executor *> executors; | ||
tipb::Executor * executor = dag_request->mutable_root_executor(); | ||
executors.push(executor); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We can use https://github.com/pingcap/tiflash/blob/e289119502cb4f2643eb1810dffb4434a611b0a9/dbms/src/Flash/Statistics/traverseExecutors.h to visit DAGRequest
Done
{ | ||
std::queue<tipb::Executor *> executors; | ||
std::queue<const tipb::Expr *> exprs; | ||
tipb::Executor * executor = dag_request->mutable_root_executor(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ditto
@@ -117,8 +122,9 @@ class DAGRequestBuilder | |||
class MockDAGRequestContext | |||
{ | |||
public: | |||
explicit MockDAGRequestContext(Context context_) | |||
explicit MockDAGRequestContext(Context context_, Int32 collation_ = TiDB::ITiDBCollator::UTF8MB4_BIN) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the default parameter not no collation
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is the default parameter not
no collation
?
Because tidb opens the collation by default recently, and sets it as UTF8MB4_BIN.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
/merge |
@ywqzzy: It seems you want to merge this PR, I will help you trigger all the tests: /run-all-tests You only need to trigger If you have any questions about the PR merge process, please refer to pr process. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the ti-community-infra/tichi repository. |
This pull request has been accepted and is ready to merge. Commit hash: 9880766
|
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
What problem does this PR solve?
Issue Number: close #5432
Problem Summary:
Support colllation for planner refactory test framework
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note