Skip to content

Commit cf84c90

Browse files
committed
Added missing required discrimination function to RowIterExpression
1 parent 0d4e630 commit cf84c90

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

sql/core.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,8 @@ type RowIterExpression interface {
4949
Expression
5050
// EvalRowIter evaluates the expression, which must be a RowIter
5151
EvalRowIter(ctx *Context, r Row) (RowIter, error)
52+
// ReturnsRowIter returns whether this expression returns a RowIter
53+
ReturnsRowIter() bool
5254
}
5355

5456
// ExpressionWithNodes is an expression that contains nodes as children.

sql/rowexec/rel_iters.go

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,8 +174,6 @@ func (i *ProjectIter) ProjectRowWithNestedIters(
174174
ctx *sql.Context,
175175
) (sql.Row, error) {
176176

177-
projections := i.projs
178-
179177
// For the set of iterators, we return one row each element in the longest of the iterators provided.
180178
// Other iterator values will be NULL after they are depleted. All non-iterator fields for the row are returned
181179
// identically for each row in the result set.
@@ -214,10 +212,10 @@ func (i *ProjectIter) ProjectRowWithNestedIters(
214212
// return the result of the iteration on each call to Eval. We also need to keep a list of all such iterators, so
215213
// that we can tell when they have all finished their iterations.
216214
var rowIterEvaluators []*RowIterEvaluator
217-
newProjs := make([]sql.Expression, len(projections))
218-
for i, proj := range projections {
215+
newProjs := make([]sql.Expression, len(i.projs))
216+
for i, proj := range i.projs {
219217
p, _, err := transform.Expr(proj, func(e sql.Expression) (sql.Expression, transform.TreeIdentity, error) {
220-
if rie, ok := e.(sql.RowIterExpression); ok {
218+
if rie, ok := e.(sql.RowIterExpression); ok && rie.ReturnsRowIter() {
221219
ri, err := rie.EvalRowIter(ctx, row)
222220
if err != nil {
223221
return nil, false, err

0 commit comments

Comments
 (0)