-
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
planner, executor: fix error code #13733
Conversation
/run-all-tests |
planner/core/errors.go
Outdated
codeWindowRowsIntervalUse = mysql.ErrWindowRowsIntervalUse | ||
codeWindowFunctionIgnoresFrame = mysql.ErrWindowFunctionIgnoresFrame | ||
codeUnsupportedOnGeneratedColumn = mysql.ErrUnsupportedOnGeneratedColumn | ||
codeUnsupportedType terror.ErrCode = mysql.ErrUnsupportedType |
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.
Could we avoid this part?
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.
Sorry I didn't get what you mean? Do you mean we want to totally get ride of codeXXX
and just use mysql.ErrXX
?
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.
yes
planner/core/errors.go
Outdated
ErrCartesianProductUnsupported = terror.ClassOptimizer.New(codeUnsupported, mysql.MySQLErrName[mysql.ErrCartesianProductUnsupported]) | ||
ErrStmtNotFound = terror.ClassOptimizer.New(codeStmtNotFound, mysql.MySQLErrName[mysql.ErrPreparedStmtNotFound]) | ||
ErrWrongParamCount = terror.ClassOptimizer.New(codeWrongParamCount, mysql.MySQLErrName[mysql.ErrWrongParamCount]) | ||
ErrSchemaChanged = terror.ClassOptimizer.New(codeSchemaChanged, mysql.MySQLErrName[mysql.ErrSchemaChanged]) | ||
ErrTablenameNotAllowedHere = terror.ClassOptimizer.New(codeTablenameNotAllowedHere, "Table '%s' from one of the %ss cannot be used in %s") |
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.
We should use the predefined error message.
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.
This one is a little different, it has a predefined error message in mysql/errname.go
for ErrTablenameNotAllowedHere
, but it is different from the native error message.
ErrTablenameNotAllowedHere: "Table '%-.192s' from one of the SELECTs cannot be used in %-.32s",
One work around is to then create another error code for this error, say ErrTablenameNotAllowedHere2
if we want every error message to be strictly defined in mysql/errname.go
.
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 think we could modify the error message in mysql/errname.go
planner/core/errors.go
Outdated
@@ -147,6 +146,12 @@ var ( | |||
|
|||
func init() { | |||
mysqlErrCodeMap := map[terror.ErrCode]uint16{ | |||
codeUnsupportedType: mysql.ErrUnsupportedType, |
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.
Please add some tests for this map.
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.
Could you give some hint on how to add tests for this map?
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.
Codecov Report
@@ Coverage Diff @@
## master #13733 +/- ##
================================================
+ Coverage 80.3765% 80.3859% +0.0094%
================================================
Files 474 474
Lines 118333 117941 -392
================================================
- Hits 95112 94808 -304
+ Misses 15804 15706 -98
- Partials 7417 7427 +10 |
@jackysp PTAL again. |
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, please fix the build and test. |
Will do, pingcap/parser#650 merged. |
/run-common-test |
3 similar comments
/run-common-test |
/run-common-test |
/run-common-test |
/run-all-tests |
/run-all-tests |
1 similar comment
/run-all-tests |
/run-all-tests tidb-test=pr/961 |
/run-common-test tidb-test=pr/961 |
1 similar comment
/run-common-test tidb-test=pr/961 |
/run-all-tests tidb-test=pr/961 |
@jackysp PR https://github.com/pingcap/tidb-test/pull/961 fixes common-test, both PR are ready for merge, PTAL. |
What problem does this PR solve?
Associating internal error code for planner/core/errors.go, expression/errors.go and executor/errors.go to parser/mysql/errcode.go.
What is changed and how it works?
Adding more error code and set up the mapping.
Check List
Tests
Code changes
Side effects
Related changes
Release note