Describe the bug
SlidingMinAccumulator reports a stale minimum when every non-NULL value has been retracted from the window but the frame is still non-empty (i.e., the frame contains only NULLs). Sliding max is correct.
To Reproduce
SELECT id, x,
MIN(x) OVER (ORDER BY id ROWS BETWEEN 1 PRECEDING AND CURRENT ROW) AS min_x
FROM (VALUES (1, 3), (2, NULL), (3, NULL)) t(id, x)
ORDER BY id;
==>
+----+------+-------+
| id | x | min_x |
+----+------+-------+
| 1 | 3 | 3 |
| 2 | NULL | 3 |
| 3 | NULL | 3 |
+----+------+-------+
Expected behavior
Postgres and DuckDB both return the expected results:
+----+------+-------+
| id | x | min_x |
+----+------+-------+
| 1 | 3 | 3 |
| 2 | NULL | 3 |
| 3 | NULL | NULL |
+----+------+-------+
Additional context
No response
Describe the bug
SlidingMinAccumulatorreports a stale minimum when every non-NULLvalue has been retracted from the window but the frame is still non-empty (i.e., the frame contains onlyNULLs). Sliding max is correct.To Reproduce
==>
Expected behavior
Postgres and DuckDB both return the expected results:
Additional context
No response