Skip to content

Commit 2158694

Browse files
committed
Added some docs, fixed a test
1 parent 8f23464 commit 2158694

File tree

3 files changed

+6
-3
lines changed

3 files changed

+6
-3
lines changed

sql/core.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,8 @@ type Expression interface {
4545
WithChildren(children ...Expression) (Expression, error)
4646
}
4747

48+
// RowIterExpression is an Expression that returns a RowIter rather than a scalar, used to implement functions that
49+
// return sets.
4850
type RowIterExpression interface {
4951
Expression
5052
// EvalRowIter evaluates the expression, which must be a RowIter

sql/rowexec/rel_iters.go

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -245,12 +245,15 @@ func (i *ProjectIter) ProjectRowWithNestedIters(
245245
return i.ProjectRowWithNestedIters(ctx)
246246
}
247247

248+
// RowIterEvaluator is an expression that returns the next value from a sql.RowIter each time Eval is called.
248249
type RowIterEvaluator struct {
249250
iter sql.RowIter
250251
typ sql.Type
251252
finished bool
252253
}
253254

255+
var _ sql.Expression = (*RowIterEvaluator)(nil)
256+
254257
func (r RowIterEvaluator) Resolved() bool {
255258
return true
256259
}
@@ -296,8 +299,6 @@ func (r RowIterEvaluator) WithChildren(children ...sql.Expression) (sql.Expressi
296299
return &r, nil
297300
}
298301

299-
var _ sql.Expression = (*RowIterEvaluator)(nil)
300-
301302
// ProjectRow evaluates a set of projections.
302303
func ProjectRow(
303304
ctx *sql.Context,

sql/types/conversion_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ func TestGeneralizeTypes(t *testing.T) {
207207
{Time, Date, DatetimeMaxPrecision},
208208
{Date, Date, Date},
209209
{Date, Timestamp, DatetimeMaxPrecision},
210-
{Timestamp, Timestamp, Timestamp},
210+
{Timestamp, Timestamp, TimestampMaxPrecision},
211211
{Timestamp, TimestampMaxPrecision, TimestampMaxPrecision},
212212
{Timestamp, Datetime, DatetimeMaxPrecision},
213213
{Null, Int64, Int64},

0 commit comments

Comments
 (0)