Skip to content

Commit 906adfa

Browse files
committed
Bug fix
1 parent 4d39c5a commit 906adfa

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

sql/planbuilder/aggregates.go

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -520,13 +520,14 @@ func (b *Builder) buildOrderedInjectedExpr(inScope *scope, e *ast.OrderedInjecte
520520
inScope.initGroupBy()
521521
gb := inScope.groupBy
522522

523-
resolvedChildren := make([]any, len(e.Children))
524-
523+
var resolvedChildren []any
525524
if len(e.Children) > 0 {
525+
resolvedChildren = make([]any, len(e.Children))
526526
for i, child := range e.Children {
527527
resolvedChildren[i] = b.buildScalar(inScope, child)
528528
}
529529
} else {
530+
resolvedChildren = make([]any, len(e.SelectExprChildren))
530531
for i, child := range e.SelectExprChildren {
531532
resolvedChildren[i] = b.selectExprToExpression(inScope, child)
532533
}
@@ -562,7 +563,7 @@ func (b *Builder) buildOrderedInjectedExpr(inScope *scope, e *ast.OrderedInjecte
562563
col := scopeColumn{col: aggName, scalar: agg, typ: agg.Type(), nullable: agg.IsNullable()}
563564
id := gb.outScope.newColumn(col)
564565

565-
agg = agg.WithId(sql.ColumnId(id)).(*aggregation.GroupConcat)
566+
agg = agg.WithId(sql.ColumnId(id)).(sql.Aggregation)
566567
gb.outScope.cols[len(gb.outScope.cols)-1].scalar = agg
567568
col.scalar = agg
568569

0 commit comments

Comments
 (0)