Skip to content

Commit

Permalink
This is an automated cherry-pick of pingcap#50070
Browse files Browse the repository at this point in the history
Signed-off-by: ti-chi-bot <[email protected]>
  • Loading branch information
hawkingrei authored and ti-chi-bot committed Jan 4, 2024
1 parent ae491e2 commit 0cb86d2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 0 deletions.
8 changes: 8 additions & 0 deletions server/conn_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -755,8 +755,16 @@ func TestConnExecutionTimeout(t *testing.T) {
require.NoError(t, err)

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

=======
require.Equal(t, "[executor:3024]Query execution was interrupted, maximum statement execution time exceeded", err.Error())
err = cc.handleQuery(context.Background(), "select /*+ set_var(max_execution_time=100) */ age, sleep(1) from testTable2 union all select age, 1 from testTable2")
require.Equal(t, "[executor:3024]Query execution was interrupted, maximum statement execution time exceeded", err.Error())
// Killed because of max execution time, reset Killed to 0.
tk.Session().GetSessionVars().SQLKiller.SendKillSignal(sqlkiller.MaxExecTimeExceeded)
>>>>>>> 62c83d40fe2 (bindinfo: extract the table hint from the union statement (#50070)):pkg/server/conn_test.go
tk.MustExec("set @@max_execution_time = 500;")

err = cc.handleQuery(context.Background(), "alter table testTable2 add index idx(age);")
Expand Down
15 changes: 15 additions & 0 deletions util/hint/hint_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,23 @@ func ExtractTableHintsFromStmtNode(node ast.Node, sctx sessionctx.Context) []*as
// check duplicated hints
checkInsertStmtHintDuplicated(node, sctx)
return x.TableHints
<<<<<<< HEAD:util/hint/hint_processor.go
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
>>>>>>> 62c83d40fe2 (bindinfo: extract the table hint from the union statement (#50070)):pkg/util/hint/hint_processor.go
default:
return nil
}
Expand Down

0 comments on commit 0cb86d2

Please sign in to comment.