Skip to content

Commit

Permalink
fixup
Browse files Browse the repository at this point in the history
  • Loading branch information
qw4990 committed Jun 17, 2024
1 parent 3e180e2 commit 0db97c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
13 changes: 13 additions & 0 deletions pkg/bindinfo/session_handle_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -381,6 +381,19 @@ func TestDropSingleBindings(t *testing.T) {
tk.MustExec("drop table t")
}

func TestIssue53834(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
tk.MustExec(`use test`)
tk.MustExec(`create table t (a varchar(1024))`)
tk.MustExec(`insert into t values (space(1024))`)
for i := 0; i < 12; i++ {
tk.MustExec(`insert into t select * from t`)
}
tk.MustExec(`create binding using replace /*+ memory_quota(1 mb) */ into t select * from t`)
tk.MustExec(`replace into t select * from t`)
}

func TestPreparedStmt(t *testing.T) {
store := testkit.CreateMockStore(t)
tk := testkit.NewTestKit(t, store)
Expand Down
4 changes: 3 additions & 1 deletion pkg/util/hint/hint_processor.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ func setTableHints4StmtNode(node ast.Node, hints []*ast.TableOptimizerHint) {
x.TableHints = hints
case *ast.DeleteStmt:
x.TableHints = hints
case *ast.InsertStmt:
x.TableHints = hints
}
}

Expand Down Expand Up @@ -203,7 +205,7 @@ type hintProcessor struct {

func (hp *hintProcessor) Enter(in ast.Node) (ast.Node, bool) {
switch v := in.(type) {
case *ast.SelectStmt, *ast.UpdateStmt, *ast.DeleteStmt:
case *ast.SelectStmt, *ast.UpdateStmt, *ast.DeleteStmt, *ast.InsertStmt:
if hp.bindHint2Ast {
if hp.tableCounter < len(hp.tableHints) {
setTableHints4StmtNode(in, hp.tableHints[hp.tableCounter])
Expand Down

0 comments on commit 0db97c8

Please sign in to comment.