Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ast/misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -2084,7 +2084,7 @@ func (n *TableOptimizerHint) Restore(ctx *RestoreCtx) error {
}
table.Restore(ctx)
}
case "index", "use_index_merge":
case "use_index", "ignore_index", "use_index_merge":
n.Tables[0].Restore(ctx)
ctx.WritePlain(" ")
for i, index := range n.Indexes {
Expand Down
9 changes: 6 additions & 3 deletions ast/misc_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -206,9 +206,12 @@ func (ts *testMiscSuite) TestUserSpec(c *C) {

func (ts *testMiscSuite) TestTableOptimizerHintRestore(c *C) {
testCases := []NodeRestoreTestCase{
{"INDEX(t1 c1)", "INDEX(`t1` `c1`)"},
{"INDEX(@sel_1 t1 c1)", "INDEX(@`sel_1` `t1` `c1`)"},
{"INDEX(t1@sel_1 c1)", "INDEX(`t1`@`sel_1` `c1`)"},
{"USE_INDEX(t1 c1)", "USE_INDEX(`t1` `c1`)"},
{"USE_INDEX(@sel_1 t1 c1)", "USE_INDEX(@`sel_1` `t1` `c1`)"},
{"USE_INDEX(t1@sel_1 c1)", "USE_INDEX(`t1`@`sel_1` `c1`)"},
{"IGNORE_INDEX(t1 c1)", "IGNORE_INDEX(`t1` `c1`)"},
{"IGNORE_INDEX(@sel_1 t1 c1)", "IGNORE_INDEX(@`sel_1` `t1` `c1`)"},
{"IGNORE_INDEX(t1@sel_1 c1)", "IGNORE_INDEX(`t1`@`sel_1` `c1`)"},
{"TIDB_SMJ(`t1`)", "TIDB_SMJ(`t1`)"},
{"TIDB_SMJ(t1)", "TIDB_SMJ(`t1`)"},
{"TIDB_SMJ(t1,t2)", "TIDB_SMJ(`t1`, `t2`)"},
Expand Down
4 changes: 3 additions & 1 deletion misc.go
Original file line number Diff line number Diff line change
Expand Up @@ -312,6 +312,7 @@ var tokenMap = map[string]int{
"IDENTIFIED": identified,
"IF": ifKwd,
"IGNORE": ignore,
"IGNORE_INDEX": hintIgnoreIndex,
"IMPORT": importKwd,
"IN": in,
"INCREMENTAL": incremental,
Expand Down Expand Up @@ -341,7 +342,6 @@ var tokenMap = map[string]int{
"IS": is,
"ISSUER": issuer,
"ISOLATION": isolation,
"USE_TOJA": hintUseToja,
"JOBS": jobs,
"JOB": job,
"JOIN": join,
Expand Down Expand Up @@ -623,8 +623,10 @@ var tokenMap = map[string]int{
"UPDATE": update,
"USAGE": usage,
"USE": use,
"USE_INDEX": hintUseIndex,
"USE_INDEX_MERGE": hintUseIndexMerge,
"USE_PLAN_CACHE": hintUsePlanCache,
"USE_TOJA": hintUseToja,
"USER": user,
"USING": using,
"UTC_DATE": utcDate,
Expand Down
Loading