Skip to content

Commit

Permalink
planner: do not add extra limit when handle the execute stmt (#30152)
Browse files Browse the repository at this point in the history
  • Loading branch information
Reminiscent committed Nov 29, 2021
1 parent 306621e commit 6d7a320
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
2 changes: 1 addition & 1 deletion planner/core/common_plans.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,7 @@ func (e *Execute) getPhysicalPlan(ctx context.Context, sctx sessionctx.Context,
}

REBUILD:
stmt := TryAddExtraLimit(sctx, prepared.Stmt)
stmt := prepared.Stmt
p, names, err := OptimizeAstNode(ctx, sctx, stmt, is)
if err != nil {
return err
Expand Down
9 changes: 9 additions & 0 deletions planner/core/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4759,6 +4759,15 @@ func (s *testIntegrationSuite) TestIssue27949(c *C) {
" └─Limit 10.00 cop[tikv] offset:0, count:100",
" └─Selection 10.00 cop[tikv] eq(test.t27949.b, 1)",
" └─TableFullScan 10000.00 cop[tikv] table:t27949 keep order:false, stats:pseudo"))

tk.MustExec("drop table if exists t")
tk.MustExec("create table t(a int, index idx_a(a));")
tk.MustExec("create binding for select * from t using select * from t use index(idx_a);")
tk.MustExec("select * from t;")
tk.MustQuery("select @@last_plan_from_binding;").Check(testkit.Rows("1"))
tk.MustExec("prepare stmt from 'select * from t';")
tk.MustExec("execute stmt;")
tk.MustQuery("select @@last_plan_from_binding;").Check(testkit.Rows("1"))
}

func (s *testIntegrationSuite) TestIssue28154(c *C) {
Expand Down

0 comments on commit 6d7a320

Please sign in to comment.