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 dfcd54a commit 586602dCopy full SHA for 586602d
sql/expression/function/aggregation/window_partition.go
@@ -232,7 +232,9 @@ func (i *WindowPartitionIter) initializePartitions(ctx *sql.Context) ([]sql.Wind
232
// At this stage, result rows are appended with the original row index for resorting. The size of
233
// [i.output] will be smaller than [i.input] if the outer sql.Node is a plan.GroupBy with fewer partitions than rows.
234
func (i *WindowPartitionIter) materializeOutput(ctx *sql.Context) (sql.WindowBuffer, error) {
235
- if len(i.input) == 0 {
+ // handle nil input specially if no partition clause
236
+ // ex: COUNT(*) on nil rows returns 0, not nil
237
+ if len(i.input) == 0 && len(i.w.PartitionBy) > 0 {
238
return nil, io.EOF
239
}
240
0 commit comments