-
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
*: differentiate types for user variables #18973
Conversation
Codecov Report
@@ Coverage Diff @@
## master #18973 +/- ##
================================================
- Coverage 79.4390% 79.3537% -0.0853%
================================================
Files 546 546
Lines 148631 148293 -338
================================================
- Hits 118071 117676 -395
- Misses 21075 21102 +27
- Partials 9485 9515 +30 |
tk.MustExec("set @v1 = 3") | ||
tk.MustExec("set @v2 = 3") | ||
tk.MustExec("set @v1 = '3'") | ||
tk.MustExec("set @v2 = '3'") |
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.
A related bug: #19002. When the variable type and column type mismatches, point-get with plan-cache enabled would return wrong result. It should be fixed in another PR, so I modify the test cases here first to make the types consistent, since the test purpose here is not on the type mismatch problem.
340c3ab
to
7298efd
Compare
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
LGTM |
/run-all-tests |
After the discussion, we decide to support different variable types in the plan cache. And |
/run-sqllogic-test-2 |
/run-all-tests |
/run-build |
/run-all-tests |
/run-unit-test |
/run-all-tests |
/run-check_dev_2 |
@eurekaka, Congratulations, you get 300 in this PR, and your total score is 300 in high-performance challenge program. DetailsTip : None Warning: cc: Mentor @lzmhhh123 |
cherry pick to release-4.0 in PR #21107 |
Signed-off-by: ti-srebot <ti-srebot@pingcap.com>
Signed-off-by: ti-srebot <ti-srebot@pingcap.com> Co-authored-by: Kenan Yao <cauchy1992@gmail.com>
What problem does this PR solve?
Issue Number: close #16820 , close #11212
#16603 and #16362 can be closed by this PR as well.
Problem Summary:
We treated all user variables as string types, so there would be cast functions added which prevent the planner to choose better plans, such as PointGet. The problem is more frequent when plan cache is enabled.
What is changed and how it works?
What's Changed:
Infer types for user variables, if the user variable is not set before, we treat it as string type. The behaviors reference https://dev.mysql.com/doc/refman/8.0/en/user-variables.html.
Related changes
pingcap/docs
/pingcap/docs-cn
:Check List
Tests
Side effects
Release note