Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

planner: do not add extra limit when handle the execute stmt #30152

Merged
merged 2 commits into from
Nov 29, 2021
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 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