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

planner, executor: check col.OrigColName instead of col.ColName in isCoveringIndex #9637

Merged
merged 3 commits into from
Mar 12, 2019

Conversation

XuHuaiyu
Copy link
Contributor

What problem does this PR solve?

fix #9636

What is changed and how it works?

Checking col.OrigColName instead of col.ColName in isCoveringIndex

Check List

Tests

  • Integration test

Code changes

  • Has exported function/method change

Side effects

N/A

Related changes

  • Need to cherry-pick to the release branch

@XuHuaiyu XuHuaiyu added type/bugfix This PR fixes a bug. sig/planner SIG: Planner labels Mar 11, 2019
@@ -423,7 +423,8 @@ func isCoveringIndex(columns []*expression.Column, indexColumns []*model.IndexCo
isIndexColumn := false
for _, indexCol := range indexColumns {
isFullLen := indexCol.Length == types.UnspecifiedLength || indexCol.Length == col.RetType.Flen
if col.ColName.L == indexCol.Name.L && isFullLen {
// We use col.OrigColName instead of col.ColName
Copy link
Member

Choose a reason for hiding this comment

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

I think adding the issue link here can help others to understand.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

ok

@@ -423,7 +423,8 @@ func isCoveringIndex(columns []*expression.Column, indexColumns []*model.IndexCo
isIndexColumn := false
for _, indexCol := range indexColumns {
isFullLen := indexCol.Length == types.UnspecifiedLength || indexCol.Length == col.RetType.Flen
if col.ColName.L == indexCol.Name.L && isFullLen {
// We use col.OrigColName instead of col.ColName
if col.OrigColName.L == indexCol.Name.L && isFullLen {
Copy link
Member

@zz-jason zz-jason Mar 11, 2019

Choose a reason for hiding this comment

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

Are there other places which use col.ColName.L instead of col.OrigColName.L?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm not sure.
It needs to be checked.

Copy link
Contributor

@eurekaka eurekaka Mar 11, 2019

Choose a reason for hiding this comment

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

Can we check UniqueID here for this case?

Copy link
Member

Choose a reason for hiding this comment

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

No... There's no place store the result converting model.IndexInfo.Columns to expression.Columns. So in many places we use model.IndexColumn directly compares with expression.Column

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

@eurekaka eurekaka added the status/LGT1 Indicates that a PR has LGTM 1. label Mar 11, 2019
@XuHuaiyu
Copy link
Contributor Author

/run-all-tests

@XuHuaiyu
Copy link
Contributor Author

/run-integration-ddl-test
/run-unit-test

@XuHuaiyu
Copy link
Contributor Author

PTAL @zz-jason @winoros

Copy link
Member

@zz-jason zz-jason left a comment

Choose a reason for hiding this comment

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

LGTM

@codecov
Copy link

codecov bot commented Mar 12, 2019

Codecov Report

Merging #9637 into master will decrease coverage by 0.0008%.
The diff coverage is 100%.

@@               Coverage Diff               @@
##            master      #9637        +/-   ##
===============================================
- Coverage   67.374%   67.3731%   -0.0009%     
===============================================
  Files          376        376                
  Lines        79262      79263         +1     
===============================================
  Hits         53402      53402                
  Misses       21089      21089                
- Partials      4771       4772         +1

@XuHuaiyu XuHuaiyu merged commit 353b216 into pingcap:master Mar 12, 2019
@XuHuaiyu XuHuaiyu deleted the check_index_filter branch March 12, 2019 02:19
XuHuaiyu added a commit to XuHuaiyu/tidb that referenced this pull request Mar 12, 2019
zz-jason pushed a commit that referenced this pull request Mar 12, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
sig/planner SIG: Planner status/LGT1 Indicates that a PR has LGTM 1. type/bugfix This PR fixes a bug.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

we should use col.OriginColName instead col.ColName when extracting index filter
4 participants