-
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 unnecessary column copy for HashAgg #8985
Optimize unnecessary column copy for HashAgg #8985
Conversation
15ff512
to
60bd8ea
Compare
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
/run-all-tests |
/test all |
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
/test all |
/test all |
/test all |
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
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
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
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: SeaRise, windtalker The full list of commands accepted by this bot can be found here. The pull request process is described here
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
[LGTM Timeline notifier]Timeline:
|
/hold |
comment |
Signed-off-by: guo-shaoge <shaoge1994@163.com>
Signed-off-by: guo-shaoge <shaoge1994@163.com>
/merge |
@guo-shaoge: Your PR was out of date, I have automatically updated it for you. At the same time I will also trigger all tests for you: /run-all-tests
If the CI test fails, you just re-trigger the test that failed and the bot will merge the PR for you after the CI passes. 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. |
/test pull-integration-test |
What problem does this PR solve?
Issue Number: close #8891
Problem Summary:
When there are group by key in select item(a.k.a. first_row), tiflash have extra agg func, which cause unnecessary copy from HashMap to result column.
What is changed and how it works?
Basic idea:
Optimization-1 (with collation):
What: For group by keys that with collation, there will be
first_row/any agg
func for it to keep original data. So no need to copy these keys from HashMap, instead just a pointer to reference its correspondingfirst_row/any
result is enough.How:
first_row
agg func in the select item.any
agg func. If not, add the 'any' agg func.key_from_agg_func
to indicate that this key is equivalent tofirst_row/any
agg func, which can avoid copying this key from the HashMap in subsequent operations. (checkDAGExpressionAnalyzer::buildAggGroupBy
)first_row/any
(which is rare, but still can happens), will skip copy keys(template argumentskip_serialize_key
is true)Optimization-2(no collation)
What: When SQL query has agg func like:
first_row(group_by_key_col)
, and that group_by_key_col has no collation. Then we can eliminate thefirst_row
agg func, just use a pointer to reference the group by key is enough.Results
before:
after:
Check List
Tests
Side effects
Documentation
Release note