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

executor: support plan replayer multi sqls #37867

Merged
merged 17 commits into from
Sep 16, 2022
Merged
12 changes: 10 additions & 2 deletions executor/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -977,8 +977,16 @@ func (b *executorBuilder) buildPlanReplayer(v *plannercore.PlanReplayer) Executo
}
e := &PlanReplayerExec{
baseExecutor: newBaseExecutor(b.ctx, v.Schema(), v.ID()),
ExecStmts: []ast.StmtNode{v.ExecStmt},
Analyze: v.Analyze,
DumpInfo: &PlanReplayerDumpInfo{
Analyze: v.Analyze,
Path: v.File,
ctx: b.ctx,
},
}
if v.ExecStmt != nil {
e.DumpInfo.ExecStmts = []ast.StmtNode{v.ExecStmt}
} else {
e.baseExecutor = newBaseExecutor(b.ctx, nil, v.ID())
}
return e
}
Expand Down
2 changes: 2 additions & 0 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ func TestPlanReplayer(t *testing.T) {
tk.MustExec("alter table t set tiflash replica 1")
tk.MustQuery("plan replayer dump explain select * from t where a=10")
tk.MustQuery("plan replayer dump explain select /*+ read_from_storage(tiflash[t]) */ * from t")
tk.MustExec("plan replayer dump explain './test/data/plan_replayer_test.txt'")
require.True(t, len(tk.Session().GetSessionVars().LastPlanReplayerToken) > 0)

tk.MustExec("create table t1 (a int)")
tk.MustExec("create table t2 (a int)")
Expand Down
Loading