-
Notifications
You must be signed in to change notification settings - Fork 5.9k
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
expression: separated arithmeticPlusIntSig #22026
base: master
Are you sure you want to change the base?
Conversation
No release note, Please follow https://github.com/pingcap/community/blob/master/contributors/release-note-checker.md |
/run-all-tests |
@breeswish PTAL |
/run-all-tests |
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.
@Tjianke
Seems that it should be math.MaxUint64-uint64(rh)
here.
expression/builtin_arithmetic_vec.go
Outdated
return types.ErrOverflow.GenWithStackByArgs("BIGINT UNSIGNED", fmt.Sprintf("(%s + %s)", b.args[0].String(), b.args[1].String())) | ||
} | ||
if lh > 0 && uint64(rh) > math.MaxUint64-uint64(lh) { | ||
if rh > 0 && uint64(lh) > math.MaxUint64-uint64(lh) { |
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.
if rh > 0 && uint64(lh) > math.MaxUint64-uint64(lh) { | |
if rh > 0 && uint64(lh) > math.MaxUint64-uint64(rh) { |
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.
Thanks for pointing out.
I think it would be better to add unit tests for OVERFLOW cases. Rest LGTM. |
00fa682
to
76adc56
Compare
LGTM |
Great ! |
/run-all-tests |
…o separatePlusSig
@Tjianke could you post the benchmark result to show the performance improvements? |
If the TiKV coprocessor writes the code in the similar way to TiDB, how could it improve the performance in the TiKV side? Do you have any benchmark result (for the demo code in TiKV) or any analysis on that? |
Sorry, I cannot provide you TiKV benchmark since I am not familiar with TiKV. But the logic here is that judging args and separating functions at planning stage(in TiDB) would save TiKV the time of judging args, therefore improve efficiency. Origin idea from @breeswish. |
From the performance benchmark, the performance is not improved, but the code complexity is improved, so I prefer not to bring in this change if there is no benefit. |
Original benchmark was inaccurate, after func sig separation, benchstat cannot compare directly between old and new function signatures, I had to rename benchmark result in newer version to compare, seems like there is improvement in newer versions(benchmark updated in main post). I wrote a script for quick reproduction. |
@Tjianke: PR needs rebase. 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. |
What problem does this PR solve?
Issue Number: closes #13973
Problem Summary:
ArithmeticPlusIntSig
at planning stage will be more efficient then current statusWhat is changed and how it works?
What's Changed:
PlusIntSig
, separatedPlusIntSig
into four signatures by sign/unsign of argumentsHow it Works:
Benchmark Result:
plusOld.txt
plusSSNew.txt
plusUSNew.txt
plusSUNew.txt
plusUUNew.txt
Check List
Tests
Release note
PlusIngSig