Skip to content

Commit

Permalink
Revert "sql,opt: pass tree.SemaContext to the execbuilder"
Browse files Browse the repository at this point in the history
This reverts commit 25b4d57. No longer
needed as AsOfSystemTime is moved to EvalContext.

Release note: None
  • Loading branch information
otan committed Jul 29, 2021
1 parent 19659d7 commit 4aa2557
Show file tree
Hide file tree
Showing 10 changed files with 8 additions and 38 deletions.
2 changes: 0 additions & 2 deletions pkg/sql/opt/bench/bench_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -484,7 +484,6 @@ func (h *harness) runSimple(tb testing.TB, query benchQuery, phase Phase) {
execMemo,
nil, /* catalog */
root,
&h.semaCtx,
&h.evalCtx,
true, /* allowAutoCommit */
)
Expand Down Expand Up @@ -538,7 +537,6 @@ func (h *harness) runPrepared(tb testing.TB, phase Phase) {
execMemo,
nil, /* catalog */
root,
&h.semaCtx,
&h.evalCtx,
true, /* allowAutoCommit */
)
Expand Down
3 changes: 0 additions & 3 deletions pkg/sql/opt/exec/execbuilder/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@ type Builder struct {
catalog cat.Catalog
e opt.Expr
disableTelemetry bool
semaCtx *tree.SemaContext
evalCtx *tree.EvalContext

// subqueries accumulates information about subqueries that are part of scalar
Expand Down Expand Up @@ -116,7 +115,6 @@ func New(
mem *memo.Memo,
catalog cat.Catalog,
e opt.Expr,
semaCtx *tree.SemaContext,
evalCtx *tree.EvalContext,
allowAutoCommit bool,
) *Builder {
Expand All @@ -126,7 +124,6 @@ func New(
mem: mem,
catalog: catalog,
e: e,
semaCtx: semaCtx,
evalCtx: evalCtx,
allowAutoCommit: allowAutoCommit,
initialAllowAutoCommit: allowAutoCommit,
Expand Down
4 changes: 1 addition & 3 deletions pkg/sql/opt/exec/execbuilder/cascades.go
Original file line number Diff line number Diff line change
Expand Up @@ -293,9 +293,7 @@ func (cb *cascadeBuilder) planCascade(
}

// 5. Execbuild the optimized expression.
eb := New(
execFactory, &o, factory.Memo(), cb.b.catalog, optimizedExpr, semaCtx, evalCtx, allowAutoCommit,
)
eb := New(execFactory, &o, factory.Memo(), cb.b.catalog, optimizedExpr, evalCtx, allowAutoCommit)
if bufferRef != nil {
// Set up the With binding.
eb.addBuiltWithExpr(cascadeInputWithID, bufferColMap, bufferRef)
Expand Down
1 change: 0 additions & 1 deletion pkg/sql/opt/exec/execbuilder/format.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ func fmtInterceptor(f *memo.ExprFmtCtx, scalar opt.ScalarExpr) string {
f.Memo,
nil, /* catalog */
scalar,
nil, /* semaCtx */
nil, /* evalCtx */
false, /* allowAutoCommit */
)
Expand Down
4 changes: 1 addition & 3 deletions pkg/sql/opt/exec/execbuilder/relational.go
Original file line number Diff line number Diff line change
Expand Up @@ -948,9 +948,7 @@ func (b *Builder) buildApplyJoin(join memo.RelExpr) (execPlan, error) {
return nil, err
}

eb := New(
ef, &o, f.Memo(), b.catalog, newRightSide, b.semaCtx, b.evalCtx, false, /* allowAutoCommit */
)
eb := New(ef, &o, f.Memo(), b.catalog, newRightSide, b.evalCtx, false /* allowAutoCommit */)
eb.disableTelemetry = true
eb.withExprs = withExprs
plan, err := eb.Build()
Expand Down
9 changes: 1 addition & 8 deletions pkg/sql/opt/exec/execbuilder/statement.go
Original file line number Diff line number Diff line change
Expand Up @@ -130,14 +130,7 @@ func (b *Builder) buildExplain(explain *memo.ExplainExpr) (execPlan, error) {
func(ef exec.ExplainFactory) (exec.Plan, error) {
// Create a separate builder for the explain query.
explainBld := New(
ef,
b.optimizer,
b.mem,
b.catalog,
explain.Input,
b.semaCtx,
b.evalCtx,
b.initialAllowAutoCommit,
ef, b.optimizer, b.mem, b.catalog, explain.Input, b.evalCtx, b.initialAllowAutoCommit,
)
explainBld.disableTelemetry = true
return explainBld.Build()
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/idxconstraint/index_constraints_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ func TestIndexConstraints(t *testing.T) {
if !remainingFilter.IsTrue() {
execBld := execbuilder.New(
nil /* execFactory */, nil /* optimizer */, f.Memo(), nil, /* catalog */
&remainingFilter, &semaCtx, &evalCtx, false, /* allowAutoCommit */
&remainingFilter, &evalCtx, false, /* allowAutoCommit */
)
expr, err := execBld.BuildScalar()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/opt/partialidx/implicator_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func TestImplicator(t *testing.T) {
} else {
execBld := execbuilder.New(
nil /* factory */, nil /* optimizer */, f.Memo(), nil, /* catalog */
&remainingFilters, &semaCtx, &evalCtx, false, /* allowAutoCommit */
&remainingFilters, &evalCtx, false, /* allowAutoCommit */
)
expr, err := execBld.BuildScalar()
if err != nil {
Expand Down
17 changes: 2 additions & 15 deletions pkg/sql/plan_opt.go
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,6 @@ func (p *planner) makeOptimizerPlan(ctx context.Context) error {
&p.stmt,
newDistSQLSpecExecFactory(p, planningMode),
execMemo,
p.SemaCtx(),
p.EvalContext(),
p.autoCommit,
)
Expand Down Expand Up @@ -245,7 +244,6 @@ func (p *planner) makeOptimizerPlan(ctx context.Context) error {
&p.stmt,
newDistSQLSpecExecFactory(p, distSQLLocalOnlyPlanning),
execMemo,
p.SemaCtx(),
p.EvalContext(),
p.autoCommit,
)
Expand All @@ -266,7 +264,6 @@ func (p *planner) makeOptimizerPlan(ctx context.Context) error {
&p.stmt,
newExecFactory(p),
execMemo,
p.SemaCtx(),
p.EvalContext(),
p.autoCommit,
)
Expand Down Expand Up @@ -557,7 +554,6 @@ func (opc *optPlanningCtx) runExecBuilder(
stmt *Statement,
f exec.Factory,
mem *memo.Memo,
semaCtx *tree.SemaContext,
evalCtx *tree.EvalContext,
allowAutoCommit bool,
) error {
Expand All @@ -567,9 +563,7 @@ func (opc *optPlanningCtx) runExecBuilder(
var containsFullIndexScan bool
if !planTop.instrumentation.ShouldBuildExplainPlan() {
// No instrumentation.
bld := execbuilder.New(
f, &opc.optimizer, mem, &opc.catalog, mem.RootExpr(), semaCtx, evalCtx, allowAutoCommit,
)
bld := execbuilder.New(f, &opc.optimizer, mem, &opc.catalog, mem.RootExpr(), evalCtx, allowAutoCommit)
plan, err := bld.Build()
if err != nil {
return err
Expand All @@ -582,14 +576,7 @@ func (opc *optPlanningCtx) runExecBuilder(
// Create an explain factory and record the explain.Plan.
explainFactory := explain.NewFactory(f)
bld := execbuilder.New(
explainFactory,
&opc.optimizer,
mem,
&opc.catalog,
mem.RootExpr(),
semaCtx,
evalCtx,
allowAutoCommit,
explainFactory, &opc.optimizer, mem, &opc.catalog, mem.RootExpr(), evalCtx, allowAutoCommit,
)
plan, err := bld.Build()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/sem/tree/eval_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ func optBuildScalar(evalCtx *tree.EvalContext, e tree.Expr) (tree.TypedExpr, err

bld := execbuilder.New(
nil /* factory */, &o, o.Memo(), nil /* catalog */, o.Memo().RootExpr(),
&semaCtx, evalCtx, false, /* allowAutoCommit */
evalCtx, false, /* allowAutoCommit */
)
expr, err := bld.BuildScalar()
if err != nil {
Expand Down

0 comments on commit 4aa2557

Please sign in to comment.