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

executor: correct range calculation for CHAR column #10124

Merged
merged 17 commits into from
May 14, 2019

Conversation

zz-jason
Copy link
Member

@zz-jason zz-jason commented Apr 11, 2019

What problem does this PR solve?

fix the wrong range calculation for:

  • point get char[n], char[n] binary, binary[n] column
  • index lookup char[n], char[n] binary, binary[n] column

This PR can:

What is changed and how it works?

specially handle the "PAD_CHAR_TO_FULL_LENGTH" for char column.

Check List

Tests

  • Unit test

Related changes

  • Need to cherry-pick to the release branch
  • Need to be included in the release note

@zz-jason
Copy link
Member Author

/run-all-tests

@zz-jason zz-jason added type/bugfix This PR fixes a bug. and removed status/DNM labels Apr 11, 2019
@zz-jason
Copy link
Member Author

/run-integration-common-test
/run-unit-test

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

Please check:

create table t(a binary(2) primary key, b char(2));
insert into t values("a ", "b");
insert into t values("a", "b");
select * from t where a = "a ";

MySQL:

mysql> select * from t where a = "a ";
+----+------+
| a  | b    |
+----+------+
| a  | b    |
+----+------+
1 row in set (0.00 sec)

TiDB:

tidb> select * from t where a = "a ";
Empty set (0.00 sec)

tidb> desc select * from t where a = "a ";
+-------------+-------+------+------------------+
| id          | count | task | operator info    |
+-------------+-------+------+------------------+
| Point_Get_1 | 1.00  | root | table:t, index:a |
+-------------+-------+------+------------------+
1 row in set (0.00 sec)

executor/point_get.go Outdated Show resolved Hide resolved
executor/point_get.go Outdated Show resolved Hide resolved
executor/point_get.go Outdated Show resolved Hide resolved
@zz-jason
Copy link
Member Author

zz-jason commented May 9, 2019

/rebuild

@zz-jason zz-jason changed the title executor: correct point calculation for CHAR[N] index column executor: correct point calculation for CHAR column May 9, 2019
@zz-jason
Copy link
Member Author

zz-jason commented May 9, 2019

/run-all-tests

@zz-jason
Copy link
Member Author

zz-jason commented May 9, 2019

/run-mybatis-test

@codecov
Copy link

codecov bot commented May 9, 2019

Codecov Report

Merging #10124 into master will increase coverage by 0.0144%.
The diff coverage is 89.855%.

@@               Coverage Diff                @@
##             master     #10124        +/-   ##
================================================
+ Coverage   77.3299%   77.3444%   +0.0144%     
================================================
  Files           412        412                
  Lines         86546      86566        +20     
================================================
+ Hits          66926      66954        +28     
+ Misses        14486      14479         -7     
+ Partials       5134       5133         -1

@zz-jason zz-jason requested review from qw4990 and XuHuaiyu and removed request for qw4990 May 13, 2019 08:02
@zz-jason zz-jason changed the title executor: correct point calculation for CHAR column executor: correct range calculation for CHAR column May 13, 2019
@zz-jason
Copy link
Member Author

/run-all-tests

Copy link
Contributor

@XuHuaiyu XuHuaiyu left a comment

Choose a reason for hiding this comment

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

LGTM

@XuHuaiyu XuHuaiyu added the status/LGT1 Indicates that a PR has LGTM 1. label May 14, 2019
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

@alivxxx alivxxx added status/LGT2 Indicates that a PR has LGTM 2. and removed status/LGT1 Indicates that a PR has LGTM 1. labels May 14, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/execution SIG execution 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.

Incorrect range for CHAR BINARY column Incorrect range for CHAR column
4 participants