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

*: add context for preprocess #38360

Merged
merged 4 commits into from
Oct 18, 2022
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 executor/adapter.go
Original file line number Diff line number Diff line change
Expand Up @@ -363,7 +363,7 @@ func (a *ExecStmt) IsReadOnly(vars *variable.SessionVars) bool {
// It returns the current information schema version that 'a' is using.
func (a *ExecStmt) RebuildPlan(ctx context.Context) (int64, error) {
ret := &plannercore.PreprocessorReturn{}
if err := plannercore.Preprocess(a.Ctx, a.StmtNode, plannercore.InTxnRetry, plannercore.InitTxnContextProvider, plannercore.WithPreprocessorReturn(ret)); err != nil {
if err := plannercore.Preprocess(ctx, a.Ctx, a.StmtNode, plannercore.InTxnRetry, plannercore.InitTxnContextProvider, plannercore.WithPreprocessorReturn(ret)); err != nil {
return 0, err
}

Expand Down
2 changes: 1 addition & 1 deletion executor/compiler.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ func (c *Compiler) Compile(ctx context.Context, stmtNode ast.StmtNode) (_ *ExecS
c.Ctx.GetSessionVars().StmtCtx.IsReadOnly = plannercore.IsReadOnly(stmtNode, c.Ctx.GetSessionVars())

ret := &plannercore.PreprocessorReturn{}
err = plannercore.Preprocess(c.Ctx,
err = plannercore.Preprocess(ctx, c.Ctx,
stmtNode,
plannercore.WithPreprocessorReturn(ret),
plannercore.InitTxnContextProvider,
Expand Down
6 changes: 3 additions & 3 deletions executor/ddl.go
Original file line number Diff line number Diff line change
Expand Up @@ -153,7 +153,7 @@ func (e *DDLExec) Next(ctx context.Context, req *chunk.Chunk) (err error) {
case *ast.CreateTableStmt:
err = e.executeCreateTable(x)
case *ast.CreateViewStmt:
err = e.executeCreateView(x)
err = e.executeCreateView(ctx, x)
case *ast.DropIndexStmt:
err = e.executeDropIndex(x)
case *ast.DropDatabaseStmt:
Expand Down Expand Up @@ -281,9 +281,9 @@ func (e *DDLExec) createSessionTemporaryTable(s *ast.CreateTableStmt) error {
return nil
}

func (e *DDLExec) executeCreateView(s *ast.CreateViewStmt) error {
func (e *DDLExec) executeCreateView(ctx context.Context, s *ast.CreateViewStmt) error {
ret := &core.PreprocessorReturn{}
err := core.Preprocess(e.ctx, s.Select, core.WithPreprocessorReturn(ret))
err := core.Preprocess(ctx, e.ctx, s.Select, core.WithPreprocessorReturn(ret))
if err != nil {
return errors.Trace(err)
}
Expand Down
4 changes: 2 additions & 2 deletions executor/executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -4931,7 +4931,7 @@ func TestIsPointGet(t *testing.T) {
stmtNode, err := s.ParseOneStmt(sqlStr, "", "")
require.NoError(t, err)
preprocessorReturn := &plannercore.PreprocessorReturn{}
err = plannercore.Preprocess(ctx, stmtNode, plannercore.WithPreprocessorReturn(preprocessorReturn))
err = plannercore.Preprocess(context.Background(), ctx, stmtNode, plannercore.WithPreprocessorReturn(preprocessorReturn))
require.NoError(t, err)
p, _, err := planner.Optimize(context.TODO(), ctx, stmtNode, preprocessorReturn.InfoSchema)
require.NoError(t, err)
Expand Down Expand Up @@ -4964,7 +4964,7 @@ func TestClusteredIndexIsPointGet(t *testing.T) {
stmtNode, err := s.ParseOneStmt(sqlStr, "", "")
require.NoError(t, err)
preprocessorReturn := &plannercore.PreprocessorReturn{}
err = plannercore.Preprocess(ctx, stmtNode, plannercore.WithPreprocessorReturn(preprocessorReturn))
err = plannercore.Preprocess(context.Background(), ctx, stmtNode, plannercore.WithPreprocessorReturn(preprocessorReturn))
require.NoError(t, err)
p, _, err := planner.Optimize(context.TODO(), ctx, stmtNode, preprocessorReturn.InfoSchema)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion executor/metrics_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ func TestStmtLabel(t *testing.T) {
stmtNode, err := parser.New().ParseOneStmt(tt.sql, "", "")
require.NoError(t, err)
preprocessorReturn := &plannercore.PreprocessorReturn{}
err = plannercore.Preprocess(tk.Session(), stmtNode, plannercore.WithPreprocessorReturn(preprocessorReturn))
err = plannercore.Preprocess(context.Background(), tk.Session(), stmtNode, plannercore.WithPreprocessorReturn(preprocessorReturn))
require.NoError(t, err)
_, _, err = planner.Optimize(context.TODO(), tk.Session(), stmtNode, preprocessorReturn.InfoSchema)
require.NoError(t, err)
Expand Down
2 changes: 1 addition & 1 deletion expression/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2852,7 +2852,7 @@ func TestFilterExtractFromDNF(t *testing.T) {
require.NoError(t, err, "error %v, for expr %s", err, tt.exprStr)
require.Len(t, stmts, 1)
ret := &plannercore.PreprocessorReturn{}
err = plannercore.Preprocess(sctx, stmts[0], plannercore.WithPreprocessorReturn(ret))
err = plannercore.Preprocess(context.Background(), sctx, stmts[0], plannercore.WithPreprocessorReturn(ret))
require.NoError(t, err, "error %v, for resolve name, expr %s", err, tt.exprStr)
p, _, err := plannercore.BuildLogicalPlanForTest(ctx, sctx, stmts[0], ret.InfoSchema)
require.NoError(t, err, "error %v, for build plan, expr %s", err, tt.exprStr)
Expand Down
2 changes: 1 addition & 1 deletion expression/typeinfer_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ func TestInferType(t *testing.T) {
require.NoError(t, err)

ret := &plannercore.PreprocessorReturn{}
err = plannercore.Preprocess(sctx, stmt, plannercore.WithPreprocessorReturn(ret))
err = plannercore.Preprocess(context.Background(), sctx, stmt, plannercore.WithPreprocessorReturn(ret))
require.NoError(t, err, comment)
p, _, err := plannercore.BuildLogicalPlanForTest(ctx, sctx, stmt, ret.InfoSchema)
require.NoError(t, err, comment)
Expand Down
8 changes: 4 additions & 4 deletions planner/core/cbo_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -246,7 +246,7 @@ func TestIndexRead(t *testing.T) {
require.Len(t, stmts, 1)
stmt := stmts[0]
ret := &core.PreprocessorReturn{}
err = core.Preprocess(ctx, stmt, core.WithPreprocessorReturn(ret))
err = core.Preprocess(context.Background(), ctx, stmt, core.WithPreprocessorReturn(ret))
require.NoError(t, err)
p, _, err := planner.Optimize(context.TODO(), ctx, stmt, ret.InfoSchema)
require.NoError(t, err)
Expand Down Expand Up @@ -276,7 +276,7 @@ func TestEmptyTable(t *testing.T) {
require.Len(t, stmts, 1)
stmt := stmts[0]
ret := &core.PreprocessorReturn{}
err = core.Preprocess(ctx, stmt, core.WithPreprocessorReturn(ret))
err = core.Preprocess(context.Background(), ctx, stmt, core.WithPreprocessorReturn(ret))
require.NoError(t, err)
p, _, err := planner.Optimize(context.TODO(), ctx, stmt, ret.InfoSchema)
require.NoError(t, err)
Expand Down Expand Up @@ -343,7 +343,7 @@ func TestAnalyze(t *testing.T) {
err = executor.ResetContextOfStmt(ctx, stmt)
require.NoError(t, err)
ret := &core.PreprocessorReturn{}
err = core.Preprocess(ctx, stmt, core.WithPreprocessorReturn(ret))
err = core.Preprocess(context.Background(), ctx, stmt, core.WithPreprocessorReturn(ret))
require.NoError(t, err)
p, _, err := planner.Optimize(context.TODO(), ctx, stmt, ret.InfoSchema)
require.NoError(t, err)
Expand Down Expand Up @@ -586,7 +586,7 @@ func BenchmarkOptimize(b *testing.B) {
require.Len(b, stmts, 1)
stmt := stmts[0]
ret := &core.PreprocessorReturn{}
err = core.Preprocess(ctx, stmt, core.WithPreprocessorReturn(ret))
err = core.Preprocess(context.Background(), ctx, stmt, core.WithPreprocessorReturn(ret))
require.NoError(b, err)

b.Run(tt.sql, func(b *testing.B) {
Expand Down
4 changes: 2 additions & 2 deletions planner/core/collect_column_stats_usage_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -256,7 +256,7 @@ func TestCollectPredicateColumns(t *testing.T) {
}
stmt, err := s.p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err, comment)
builder, _ := NewPlanBuilder().Init(s.ctx, s.is, &hint.BlockHintProcessor{})
p, err := builder.Build(ctx, stmt)
Expand Down Expand Up @@ -333,7 +333,7 @@ func TestCollectHistNeededColumns(t *testing.T) {
}
stmt, err := s.p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err, comment)
builder, _ := NewPlanBuilder().Init(s.ctx, s.is, &hint.BlockHintProcessor{})
p, err := builder.Build(ctx, stmt)
Expand Down
2 changes: 1 addition & 1 deletion planner/core/indexmerge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ func TestIndexMergePathGeneration(t *testing.T) {
for i, tc := range input {
stmt, err := parser.ParseOneStmt(tc, "", "")
require.NoErrorf(t, err, "case:%v sql:%s", i, tc)
err = Preprocess(sctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: is}))
err = Preprocess(context.Background(), sctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: is}))
require.NoError(t, err)
builder, _ := NewPlanBuilder().Init(MockContext(), is, &hint.BlockHintProcessor{})
p, err := builder.Build(ctx, stmt)
Expand Down
34 changes: 17 additions & 17 deletions planner/core/logical_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -502,7 +502,7 @@ func TestSubquery(t *testing.T) {
stmt, err := s.p.ParseOneStmt(ca, "", "")
require.NoError(t, err, comment)

err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
p, _, err := BuildLogicalPlanForTest(ctx, s.ctx, stmt, s.is)
require.NoError(t, err)
Expand Down Expand Up @@ -530,7 +530,7 @@ func TestPlanBuilder(t *testing.T) {
require.NoError(t, err, comment)

s.ctx.GetSessionVars().SetHashJoinConcurrency(1)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
p, _, err := BuildLogicalPlanForTest(ctx, s.ctx, stmt, s.is)
require.NoError(t, err)
Expand Down Expand Up @@ -927,7 +927,7 @@ func TestValidate(t *testing.T) {
comment := fmt.Sprintf("for %s", sql)
stmt, err := s.p.ParseOneStmt(sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
_, _, err = BuildLogicalPlanForTest(ctx, s.ctx, stmt, s.is)
if tt.err == nil {
Expand Down Expand Up @@ -1422,7 +1422,7 @@ func TestVisitInfo(t *testing.T) {
require.NoError(t, err, comment)

// TODO: to fix, Table 'test.ttt' doesn't exist
_ = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
_ = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
domain.GetDomain(sctx).MockInfoCacheAndLoadInfoSchema(s.is)
Expand Down Expand Up @@ -1502,7 +1502,7 @@ func TestUnion(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tt)
stmt, err := s.p.ParseOneStmt(tt, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
Expand Down Expand Up @@ -1535,7 +1535,7 @@ func TestTopNPushDown(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tt)
stmt, err := s.p.ParseOneStmt(tt, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
Expand Down Expand Up @@ -1612,7 +1612,7 @@ func TestOuterJoinEliminator(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tt)
stmt, err := s.p.ParseOneStmt(tt, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
Expand Down Expand Up @@ -1649,7 +1649,7 @@ func TestSelectView(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tt.sql)
stmt, err := s.p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
builder, _ := NewPlanBuilder().Init(MockContext(), s.is, &hint.BlockHintProcessor{})
p, err := builder.Build(ctx, stmt)
Expand Down Expand Up @@ -1732,7 +1732,7 @@ func (s *plannerSuiteWithOptimizeVars) optimize(ctx context.Context, sql string)
if err != nil {
return nil, nil, err
}
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
if err != nil {
return nil, nil, err
}
Expand Down Expand Up @@ -1841,7 +1841,7 @@ func TestSkylinePruning(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tt.sql)
stmt, err := s.p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
Expand Down Expand Up @@ -1914,7 +1914,7 @@ func TestFastPlanContextTables(t *testing.T) {
for _, tt := range tests {
stmt, err := s.p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
s.ctx.GetSessionVars().StmtCtx.Tables = nil
p := TryFastPlan(s.ctx, stmt)
Expand Down Expand Up @@ -1946,7 +1946,7 @@ func TestUpdateEQCond(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tt.sql)
stmt, err := s.p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
Expand All @@ -1965,7 +1965,7 @@ func TestConflictedJoinTypeHints(t *testing.T) {
ctx := context.TODO()
stmt, err := s.p.ParseOneStmt(sql, "", "")
require.NoError(t, err)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
Expand All @@ -1988,7 +1988,7 @@ func TestSimplyOuterJoinWithOnlyOuterExpr(t *testing.T) {
ctx := context.TODO()
stmt, err := s.p.ParseOneStmt(sql, "", "")
require.NoError(t, err)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err)
sctx := MockContext()
builder, _ := NewPlanBuilder().Init(sctx, s.is, &hint.BlockHintProcessor{})
Expand Down Expand Up @@ -2042,7 +2042,7 @@ func TestResolvingCorrelatedAggregate(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tt.sql)
stmt, err := s.p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err, comment)
p, _, err := BuildLogicalPlanForTest(ctx, s.ctx, stmt, s.is)
require.NoError(t, err, comment)
Expand Down Expand Up @@ -2084,7 +2084,7 @@ func TestFastPathInvalidBatchPointGet(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, tc.sql)
stmt, err := s.p.ParseOneStmt(tc.sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err, comment)
plan := TryFastPlan(s.ctx, stmt)
if tc.fastPlan {
Expand All @@ -2106,7 +2106,7 @@ func TestTraceFastPlan(t *testing.T) {
comment := fmt.Sprintf("sql:%s", sql)
stmt, err := s.p.ParseOneStmt(sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err, comment)
plan := TryFastPlan(s.ctx, stmt)
require.NotNil(t, plan)
Expand Down
2 changes: 1 addition & 1 deletion planner/core/logical_plan_trace_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -399,7 +399,7 @@ func TestSingleRuleTraceStep(t *testing.T) {
comment := fmt.Sprintf("case:%v sql:%s", i, sql)
stmt, err := s.p.ParseOneStmt(sql, "", "")
require.NoError(t, err, comment)
err = Preprocess(s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
err = Preprocess(context.Background(), s.ctx, stmt, WithPreprocessorReturn(&PreprocessorReturn{InfoSchema: s.is}))
require.NoError(t, err, comment)
sctx := MockContext()
sctx.GetSessionVars().StmtCtx.EnableOptimizeTrace = true
Expand Down
8 changes: 4 additions & 4 deletions planner/core/physical_plan_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ func TestAnalyzeBuildSucc(t *testing.T) {
} else if err != nil {
continue
}
err = core.Preprocess(tk.Session(), stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
err = core.Preprocess(context.Background(), tk.Session(), stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
require.NoError(t, err)
_, _, err = planner.Optimize(context.Background(), tk.Session(), stmt, is)
if tt.succ {
Expand Down Expand Up @@ -165,7 +165,7 @@ func TestAnalyzeSetRate(t *testing.T) {
stmt, err := p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)

err = core.Preprocess(tk.Session(), stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
err = core.Preprocess(context.Background(), tk.Session(), stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
require.NoError(t, err, comment)
p, _, err := planner.Optimize(context.Background(), tk.Session(), stmt, is)
require.NoError(t, err, comment)
Expand Down Expand Up @@ -310,7 +310,7 @@ func TestDAGPlanBuilderBasePhysicalPlan(t *testing.T) {
stmt, err := p.ParseOneStmt(tt, "", "")
require.NoError(t, err, comment)

err = core.Preprocess(se, stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
err = core.Preprocess(context.Background(), se, stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
require.NoError(t, err)
p, _, err := planner.Optimize(context.TODO(), se, stmt, is)
require.NoError(t, err)
Expand Down Expand Up @@ -1658,7 +1658,7 @@ func TestDAGPlanBuilderSplitAvg(t *testing.T) {
stmt, err := p.ParseOneStmt(tt.sql, "", "")
require.NoError(t, err, comment)

err = core.Preprocess(tk.Session(), stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
err = core.Preprocess(context.Background(), tk.Session(), stmt, core.WithPreprocessorReturn(&core.PreprocessorReturn{InfoSchema: is}))
require.NoError(t, err)
p, _, err := planner.Optimize(context.TODO(), tk.Session(), stmt, is)
require.NoError(t, err, comment)
Expand Down
Loading