You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Streaming aggregation produces wrong result with grouping sets #24421
-- data is a test file within datafusion repo
> CREATE EXTERNAL TABLE grouping_set_ordered (
a0 INTEGER,
a INTEGER,
b INTEGER,
c INTEGER,
d INTEGER
)
STORED AS CSV
WITH ORDER (c)
LOCATION '/Users/yongting/Code/datafusion-grouping-sets-ordering/datafusion/core/tests/data/window_2.csv'
OPTIONS ('format.has_header''true');> SELECT c
FROM (
SELECT b, c, grouping(b, c) AS gid
FROM grouping_set_ordered
GROUP BY GROUPING SETS ((b, c), (c))
)
ORDER BY c
LIMIT 10;
+---+
| c |
+---+
| 0 || 1 || 2 || 3 || 4 || 5 || 6 || 7 || 8 || 9 |
+---+
10 row(s) fetched.
Elapsed 0.002 seconds.
Because we have grouping set ((b,c), (c)), each distinct c value should appear twice in the output
D SELECT b,c
FROM (
SELECT b, c, grouping(b, c) AS gid
FROM grouping_set_ordered
GROUP BY GROUPING SETS ((b, c), (c))
)
ORDER BY c
LIMIT 10;
┌───────┬───────┐
│ b │ c │
│ int64 │ int64 │
├───────┼───────┤
│ 0 │ 0 │
│ NULL │ 0 │
│ 0 │ 1 │
│ NULL │ 1 │
│ NULL │ 2 │
│ 0 │ 2 │
│ NULL │ 3 │
│ 0 │ 3 │
│ 0 │ 4 │
│ NULL │ 4 │
├───────┴───────┤
│ 10 rows │
└───────────────┘
Activity
fix: Streaming aggregation produces wrong result with grouping sets (a…