-
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
parser: add parser rules to support kill '1' #30941
base: master
Are you sure you want to change the base?
Conversation
[REVIEW NOTIFICATION] This pull request has not been approved. To complete the pull request process, please ask the reviewers in the list to review by filling The full list of commands accepted by this bot can be found here. Reviewer can indicate their review by submitting an approval review. |
Code Coverage Details: https://codecov.io/github/pingcap/tidb/commit/7664abd2d50ec45b43c26ca3070c3a8977dc2abe |
/run-check_dev_2 |
case string: | ||
n, err := strconv.Atoi(v) | ||
if err != nil { | ||
return 0 | ||
} | ||
return uint64(n) |
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.
I don't think it's a good idea to cast a string to an integer in the parser. I think storing the string in the AST and letting the SQL engine cast the value will be better. WDYT? @tangenta
@znhh6018: 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. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #30941 +/- ##
================================================
- Coverage 63.5775% 63.5688% -0.0088%
================================================
Files 767 767
Lines 252361 252361
================================================
- Hits 160445 160423 -22
- Misses 79150 79160 +10
- Partials 12766 12778 +12 |
What problem does this PR solve?
Issue Number: close #27932
Problem Summary:
add support for kill '1' , before this we just support kill 1
modify rules in parser.y , if it's '1' , use strconv.Atoi() to convert '1' to 1.
If we input kill 'asd' ,strconv.Atoi() wil err and we just return 0 , it's consistent with mysql 8.0.
This is result in mysql 8.0.18
`mysql> kill '1';
ERROR 1094 (HY000): Unknown thread id: 1
mysql> kill 'asd';
ERROR 1094 (HY000): Unknown thread id: 0`
From this we can see , mysql will convert 'asd' to 0.
What is changed and how it works?
Check List
Tests
Side effects
Documentation
Release note