Skip to content

Commit 94e279c

Browse files
committed
Added nested iter logic to Project node
1 parent 220353c commit 94e279c

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

sql/plan/project.go

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,15 @@ import (
2626
// Project is a projection of certain expression from the children node.
2727
type Project struct {
2828
UnaryNode
29-
Projections []sql.Expression
30-
CanDefer bool
31-
deps sql.ColSet
29+
// Projections are the expressions to be projected on the row returned by the child node
30+
Projections []sql.Expression
31+
// CanDefer is true when the projection evaluation can be deferred to row spooling, which allows us to avoid a
32+
// separate iterator for the project node.
33+
CanDefer bool
34+
// IncludesNestedIters is true when the projection includes nested iterators because of expressions that return
35+
// a RowIter.
36+
IncludesNestedIters bool
37+
deps sql.ColSet
3238
}
3339

3440
var _ sql.Expressioner = (*Project)(nil)
@@ -202,8 +208,16 @@ func (p *Project) WithExpressions(exprs ...sql.Expression) (sql.Node, error) {
202208
return &np, nil
203209
}
204210

211+
// WithCanDefer returns a new Project with the CanDefer field set to the given value.
205212
func (p *Project) WithCanDefer(canDefer bool) *Project {
206213
np := *p
207214
np.CanDefer = canDefer
208215
return &np
209216
}
217+
218+
// WithIncludesNestedIters returns a new Project with the IncludesNestedIters field set to the given value.
219+
func (p *Project) WithIncludesNestedIters(includesNestedIters bool) *Project {
220+
np := *p
221+
np.IncludesNestedIters = includesNestedIters
222+
return &np
223+
}

0 commit comments

Comments
 (0)