-
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
Separate signatures for PlusInt #13973
Labels
Comments
This was referenced Dec 9, 2019
I am trying fix it |
/pick-up-challenge |
@zhaoqian888 pick up issue success |
This was referenced Dec 24, 2020
/pick-up-challenge #22026 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Description
Currently for the PlusInt built-in function, TiDB executes different logic according to whether LHS and RHS is signed or unsigned:
func (b *builtinArithmeticPlusIntSig) plusUU
func (b *builtinArithmeticPlusIntSig) plusUS
func (b *builtinArithmeticPlusIntSig) plusSU
func (b *builtinArithmeticPlusIntSig) plusSS
The actual logic is determined in
func (b *builtinArithmeticPlusIntSig) vecEvalInt
, i.e. re-checked every 1024 rows.Meanwhile, at TiKV side, TiKV also does the same thing in the function signature mapper:
A better way is to separate UU/US/SU/SS into different signatures at the planning stage instead of execution stage, i.e.
func (c *arithmeticPlusFunctionClass) getFunction
. A separation ingetFunction
can benefit both TiDB execution and TiKV execution, which can make the code simple, keep TiKV pure (no function deduction logic) and make execution slightly faster.To finish this task, you need to:
Modify tipb to introduce 4 new signatures, like:
(for compatibility consideration,
builtinArithmeticPlusInt
should be kept in tipb so that TiKV can still support old TiDB)Modify the
func (c *arithmeticPlusFunctionClass) getFunction
to introduce dispatch logic, dispatching to the new 4 signatures according to the operator's unsigned flag.Implement the new 4 function signature (and their vectorized version) by copying and refining code from the original function signature.
Optionally, you may consider modifying TiKV code base as well, to support these 4 newly added signatures. This will be in a separated task in TiKV side.
Difficulty
Score
Mentor(s)
Recommended Skills
The text was updated successfully, but these errors were encountered: