Skip to content

Commit

Permalink
bindinfo: extract the table hint from the union statement (#50070) (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
ti-chi-bot authored Jan 23, 2024
1 parent ea0f9cc commit abe9974
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
1 change: 0 additions & 1 deletion server/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -756,7 +756,6 @@ func TestConnExecutionTimeout(t *testing.T) {

err = cc.handleQuery(context.Background(), "select /*+ MAX_EXECUTION_TIME(100)*/ * FROM testTable2 WHERE SLEEP(1);")
require.NoError(t, err)

tk.MustExec("set @@max_execution_time = 500;")

err = cc.handleQuery(context.Background(), "alter table testTable2 add index idx(age);")
Expand Down
12 changes: 12 additions & 0 deletions util/hint/hint_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,18 @@ func ExtractTableHintsFromStmtNode(node ast.Node, sctx sessionctx.Context) []*as
return x.TableHints
case *ast.ExplainStmt:
return ExtractTableHintsFromStmtNode(x.Stmt, sctx)
case *ast.SetOprStmt:
var result []*ast.TableOptimizerHint
if x.SelectList == nil {
return nil
}
for _, s := range x.SelectList.Selects {
tmp := ExtractTableHintsFromStmtNode(s, sctx)
if len(tmp) != 0 {
result = append(result, tmp...)
}
}
return result
default:
return nil
}
Expand Down

0 comments on commit abe9974

Please sign in to comment.