Skip to content

Commit d586996

Browse files
committed
return EOF for materializeOutput when input length is 0
1 parent 1d3b1bb commit d586996

File tree

1 file changed

+1
-3
lines changed

1 file changed

+1
-3
lines changed

sql/expression/function/aggregation/window_partition.go

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -233,9 +233,7 @@ func (i *WindowPartitionIter) initializePartitions(ctx *sql.Context) ([]sql.Wind
233233
// At this stage, result rows are appended with the original row index for resorting. The size of
234234
// [i.output] will be smaller than [i.input] if the outer sql.Node is a plan.GroupBy with fewer partitions than rows.
235235
func (i *WindowPartitionIter) materializeOutput(ctx *sql.Context) (sql.WindowBuffer, error) {
236-
// handle nil input specially if no partition clause
237-
// ex: COUNT(*) on nil rows returns 0, not nil
238-
if len(i.input) == 0 && len(i.w.PartitionBy) > 0 {
236+
if len(i.input) == 0 {
239237
return nil, io.EOF
240238
}
241239

0 commit comments

Comments
 (0)