Skip to content
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

Merged
merged 3 commits into from
Dec 17, 2019

Conversation

winoros
Copy link
Member

@winoros winoros commented Dec 10, 2019

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

  • Unit test

Code changes

  • Has exported function/method change

Related changes

  • Need to cherry-pick to the release branch

Release note

  • Write release note for bug-fix or new feature.

@winoros winoros added type/bugfix This PR fixes a bug. component/expression sig/execution SIG execution labels Dec 10, 2019
@winoros winoros requested review from a team as code owners December 10, 2019 07:40
@ghost ghost requested review from wshwsh12 and removed request for a team December 10, 2019 07:40
@codecov
Copy link

codecov bot commented Dec 10, 2019

Codecov Report

Merging #14007 into master will decrease coverage by 0.14%.
The diff coverage is 90%.

@@               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()
Copy link
Member Author

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

Copy link
Contributor

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?

Copy link
Contributor

@alivxxx alivxxx left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@eurekaka eurekaka left a 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()
Copy link
Contributor

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?

Copy link
Contributor

@lzmhhh123 lzmhhh123 left a 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.

Copy link
Contributor

@lzmhhh123 lzmhhh123 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@lzmhhh123 lzmhhh123 added status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. labels Dec 17, 2019
@sre-bot
Copy link
Contributor

sre-bot commented Dec 17, 2019

/run-all-tests

@sre-bot
Copy link
Contributor

sre-bot commented Dec 17, 2019

@winoros merge failed.

@winoros
Copy link
Member Author

winoros commented Dec 17, 2019

/rebuild

@winoros winoros merged commit 438d39e into pingcap:master Dec 17, 2019
@winoros winoros deleted the revert-10124 branch December 17, 2019 07:25
@sre-bot
Copy link
Contributor

sre-bot commented Dec 17, 2019

cherry pick to release-3.0 failed

winoros added a commit to winoros/tidb that referenced this pull request Dec 20, 2019
XiaTianliang pushed a commit to XiaTianliang/tidb that referenced this pull request Dec 21, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/expression sig/execution SIG execution status/can-merge Indicates a PR has been approved by a committer. status/LGT2 Indicates that a PR has LGTM 2. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants