Skip to content

Commit

Permalink
sql: remove planDataSource field in applyJoinNode
Browse files Browse the repository at this point in the history
The `planDataSource` field of `applyJoinNode` had a `columns` sub-field
that was redundant with the `applyJoinNode`'s `columns` field.
`planDataSource` has been replaced with `planNode` to avoid confusion
and misuse.

Release note: None
  • Loading branch information
mgartner committed Dec 20, 2024
1 parent a67c92f commit 984a16b
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 9 deletions.
10 changes: 5 additions & 5 deletions pkg/sql/apply_join.go
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ type applyJoinNode struct {
joinType descpb.JoinType

// The data source with no outer columns.
input planDataSource
input planNode

// pred represents the join predicate.
pred *joinPredicate
Expand Down Expand Up @@ -75,7 +75,7 @@ type applyJoinNode struct {

func newApplyJoinNode(
joinType descpb.JoinType,
left planDataSource,
left planNode,
rightCols colinfo.ResultColumns,
pred *joinPredicate,
planRightSideFn exec.ApplyJoinPlanRightSideFn,
Expand Down Expand Up @@ -193,7 +193,7 @@ func (a *applyJoinNode) Next(params runParams) (bool, error) {
}

// We need a new row on the left.
ok, err := a.input.plan.Next(params)
ok, err := a.input.Next(params)
if err != nil {
return false, err
}
Expand All @@ -205,7 +205,7 @@ func (a *applyJoinNode) Next(params runParams) (bool, error) {

// Extract the values of the outer columns of the other side of the apply
// from the latest input row.
leftRow := a.input.plan.Values()
leftRow := a.input.Values()
a.run.leftRow = leftRow
a.iterationCount++

Expand Down Expand Up @@ -372,7 +372,7 @@ func (a *applyJoinNode) Values() tree.Datums {
}

func (a *applyJoinNode) Close(ctx context.Context) {
a.input.plan.Close(ctx)
a.input.Close(ctx)
a.run.rightRows.Close(ctx)
if a.run.rightRowsIterator != nil {
a.run.rightRowsIterator.Close()
Expand Down
7 changes: 4 additions & 3 deletions pkg/sql/opt_exec_factory.go
Original file line number Diff line number Diff line change
Expand Up @@ -447,9 +447,10 @@ func (ef *execFactory) ConstructApplyJoin(
onCond tree.TypedExpr,
planRightSideFn exec.ApplyJoinPlanRightSideFn,
) (exec.Node, error) {
leftSrc := asDataSource(left)
pred := makePredicate(joinType, leftSrc.columns, rightColumns, onCond)
return newApplyJoinNode(joinType, leftSrc, rightColumns, pred, planRightSideFn)
l := left.(planNode)
leftCols := planColumns(l)
pred := makePredicate(joinType, leftCols, rightColumns, onCond)
return newApplyJoinNode(joinType, l, rightColumns, pred, planRightSideFn)
}

// ConstructMergeJoin is part of the exec.Factory interface.
Expand Down
2 changes: 1 addition & 1 deletion pkg/sql/walk.go
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ func (v *planVisitor) visitInternal(plan planNode, name string) {
case *zigzagJoinNode:

case *applyJoinNode:
n.input.plan = v.visit(n.input.plan)
n.input = v.visit(n.input)

case *joinNode:
n.left.plan = v.visit(n.left.plan)
Expand Down

0 comments on commit 984a16b

Please sign in to comment.