Skip to content

Commit

Permalink
planner: fix index merge hint case sensitive (#37534)
Browse files Browse the repository at this point in the history
close #37273
  • Loading branch information
Yisaer authored Sep 2, 2022
1 parent 2b29cd5 commit daf546f
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
2 changes: 1 addition & 1 deletion planner/core/stats.go
Original file line number Diff line number Diff line change
Expand Up @@ -622,7 +622,7 @@ func (ds *DataSource) isInIndexMergeHints(name string) bool {
return true
}
for _, hintName := range hint.indexHint.IndexNames {
if name == hintName.String() {
if strings.EqualFold(strings.ToLower(name), strings.ToLower(hintName.String())) {
return true
}
}
Expand Down
1 change: 1 addition & 0 deletions planner/core/testdata/integration_suite_in.json
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@
"name": "TestIndexMerge",
"cases": [
"explain format = 'brief' select /*+ USE_INDEX_MERGE(t, a, b) */ * from t where a = 1 or b = 2",
"explain format = 'brief' select /*+ USE_INDEX_MERGE(t, A, B) */ * from t where a = 1 or b = 2",
"explain format = 'brief' select /*+ USE_INDEX_MERGE(t, primary) */ * from t where 1 or t.c",
"explain format = 'brief' select /*+ USE_INDEX_MERGE(t, a, b, c) */ * from t where 1 or t.a = 1 or t.b = 2"
]
Expand Down
9 changes: 9 additions & 0 deletions planner/core/testdata/integration_suite_out.json
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,15 @@
"└─TableRowIDScan(Probe) 2.00 cop[tikv] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "explain format = 'brief' select /*+ USE_INDEX_MERGE(t, A, B) */ * from t where a = 1 or b = 2",
"Plan": [
"IndexMerge 2.00 root ",
"├─IndexRangeScan(Build) 1.00 cop[tikv] table:t, index:a(a) range:[1,1], keep order:false, stats:pseudo",
"├─IndexRangeScan(Build) 1.00 cop[tikv] table:t, index:b(b) range:[2,2], keep order:false, stats:pseudo",
"└─TableRowIDScan(Probe) 2.00 cop[tikv] table:t keep order:false, stats:pseudo"
]
},
{
"SQL": "explain format = 'brief' select /*+ USE_INDEX_MERGE(t, primary) */ * from t where 1 or t.c",
"Plan": [
Expand Down

0 comments on commit daf546f

Please sign in to comment.