-
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
*: revert #10124 and remove sql mode PadCharToFullLength
#14007
Conversation
d8e8bcc
to
8fd0024
Compare
Codecov Report
@@ Coverage Diff @@
## master #14007 +/- ##
===============================================
- Coverage 80.2931% 80.153% -0.1401%
===============================================
Files 483 481 -2
Lines 122130 120452 -1678
===============================================
- Hits 98062 96546 -1516
+ Misses 16317 16189 -128
+ Partials 7751 7717 -34 |
@@ -186,7 +185,9 @@ func encodeIndexKey(e *baseExecutor, tblInfo *model.TableInfo, idxInfo *model.In | |||
for i := range idxVals { | |||
colInfo := tblInfo.Columns[idxInfo.Columns[i].Offset] | |||
if colInfo.Tp == mysql.TypeString || colInfo.Tp == mysql.TypeVarString || colInfo.Tp == mysql.TypeVarchar { | |||
idxVals[i], err = ranger.HandlePadCharToFullLength(sc, &colInfo.FieldType, idxVals[i]) | |||
var str string | |||
str, err = idxVals[i].ToString() |
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.
table.CastValue will append 0x0
if the string value's length is smaller than the BINARY column's length.
So here keep this if branch, don't use table.CastValue
on string values
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.
Add this comment into code as well?
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
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. Don't forget to update compatibility doc https://github.com/pingcap/docs/blob/master/v2.0/sql/mysql-compatibility.md as well.
@@ -186,7 +185,9 @@ func encodeIndexKey(e *baseExecutor, tblInfo *model.TableInfo, idxInfo *model.In | |||
for i := range idxVals { | |||
colInfo := tblInfo.Columns[idxInfo.Columns[i].Offset] | |||
if colInfo.Tp == mysql.TypeString || colInfo.Tp == mysql.TypeVarString || colInfo.Tp == mysql.TypeVarchar { | |||
idxVals[i], err = ranger.HandlePadCharToFullLength(sc, &colInfo.FieldType, idxVals[i]) | |||
var str string | |||
str, err = idxVals[i].ToString() |
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.
Add this comment into code as well?
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. Will approve after adding comments.
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
/run-all-tests |
@winoros merge failed. |
/rebuild |
cherry pick to release-3.0 failed |
What problem does this PR solve?
Remove the sql mode
PadCharToFullLength
. Since MySQL 8.0 will remove it soon.After this pr, when scan data/compare data, we won't ignore the trailing space.
Check List
Tests
Code changes
Related changes
Release note