We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent d586996 commit 7db3859Copy full SHA for 7db3859
sql/expression/function/aggregation/window_partition.go
@@ -233,7 +233,9 @@ func (i *WindowPartitionIter) initializePartitions(ctx *sql.Context) ([]sql.Wind
233
// At this stage, result rows are appended with the original row index for resorting. The size of
234
// [i.output] will be smaller than [i.input] if the outer sql.Node is a plan.GroupBy with fewer partitions than rows.
235
func (i *WindowPartitionIter) materializeOutput(ctx *sql.Context) (sql.WindowBuffer, error) {
236
- if len(i.input) == 0 {
+ // 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 {
239
return nil, io.EOF
240
}
241
0 commit comments