-
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: check col.OrigColName instead of col.ColName in isCoveringIndex #9637
Conversation
planner/core/find_best_task.go
Outdated
@@ -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 |
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 adding the issue link here can help others to understand.
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.
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 { |
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.
Are there other places which use col.ColName.L
instead of col.OrigColName.L
?
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'm not sure.
It needs to be checked.
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.
Can we check UniqueID
here for this case?
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.
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
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 |
/run-integration-ddl-test |
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
Codecov Report
@@ 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 |
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
Code changes
Side effects
N/A
Related changes