-
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
Optimize block sort #5908
Optimize block sort #5908
Conversation
Signed-off-by: Zhigao Tong <tongzhigao@pingcap.com>
[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. |
/run-all-tests |
/run-unit-test |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
/run-all-tests |
1 similar comment
/run-all-tests |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
fc0be79
to
d6683c1
Compare
/run-all-tests |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
It may also be an optional way if the overhead about materialization is small. |
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.
consider add a FastPathPermutationSort<1>, which is commoner than 2 columns
|
||
// only for uint64, int64, string | ||
template <typename ColumnCmpA, typename ColumnCmpB> | ||
struct MultiColumnSortFastPath |
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.
MultiColumn
is is actullay two column?
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.
Yes, if use 3 columns, there will be too many template instantiations. We may need to optimize later if necessary.
dbms/src/Interpreters/sortBlock.cpp
Outdated
} | ||
}; | ||
|
||
struct CollatorDesc : boost::noncopyable |
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 use CollatorDesc
as the name, maybe use FastSortDesc
instead?
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
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.
done
dbms/src/Interpreters/sortBlock.cpp
Outdated
} | ||
}; | ||
|
||
struct PartialSortingLessWithCollation | ||
{ | ||
const ColumnsWithSortDescriptions & columns; | ||
const CollatorDesc & collator_desc; |
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.
Using CollatorDesc
instead of ColumnsWithSortDescriptions
seems does not make too much difference?
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.
PartialSortingLessWithCollation
uses member variables has_collation
and need_collations
of CollatorDesc
We already have such optimization : tiflash/dbms/src/Interpreters/sortBlock.cpp Lines 123 to 141 in 3674439
|
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
dbms/src/Interpreters/sortBlock.cpp
Outdated
} | ||
}; | ||
|
||
struct PartialSortingLessWithCollation | ||
{ | ||
const ColumnsWithSortDescriptions & columns; | ||
const FastSortDesc & collator_desc; |
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.
The variable name should also be modified.
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.
done
/hold |
/merge |
@solotzg: 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: f117304
|
/rebuild |
/run-all-tests |
/rebuild |
/merge |
@solotzg: 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. |
/run-integration-test |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
/unhold |
Coverage for changed files
Coverage summary
full coverage report (for internal network access only) |
This reverts commit 4f66bc3.
What problem does this PR solve?
Issue Number: ref #5294
What is changed and how it works?
Benchmark
ENV
SQL
STR(utf8 collator),UINT64
SQL
STR(utf8 collator),STR(utf8 collator)
SQL
INT64,STR(utf8 collator)
Check List
Tests
Side effects
Documentation
Release note