-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
executor: using ToHashKey to check equality of decimal when count(distinct) #9901
Conversation
Codecov Report
@@ Coverage Diff @@
## master #9901 +/- ##
================================================
+ Coverage 77.2034% 77.2172% +0.0138%
================================================
Files 405 405
Lines 81635 81667 +32
================================================
+ Hits 63025 63061 +36
+ Misses 13939 13929 -10
- Partials 4671 4677 +6 |
/run-all-tests tidb-test=pr/581 |
1 similar comment
/run-all-tests tidb-test=pr/581 |
/run-all-tests tidb-test=pr/581 |
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
What's the reason that we don't call EncodeKey here? For performance?
They are almost the same, calling |
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
What problem does this PR solve?
fix #9900
What is changed and how it works?
Using MyDecimal.ToHashKey to check the equality of decimal when in when count(distinct).
Before this commit, we wrap a
cast as decimal(52, 31)
for both children of union.After the cast, the value from the int column becomes
{9 3 3 false [1 0 0 0 0 0 0 0 0]}
the value from the decimal column becomes
{3 3 3 false [1 0 0 0 0 0 0 0 0]}
.Which is thought as in-equal when compared directly.
Check List
Tests
Code changes
Side effects
Before this commit, we use the value as a hash-key without evaluating.
This commit may cause some performance regression since we evaluating invoke MyDecimal.ToHashKey for every decimal.
I've tested it using tpch 10G dataset.
Related changes