2010YOUY01 opened a new issue, #24421:
URL: https://github.com/apache/datafusion/issues/24421
### Describe the bug
Producer in `datafusion-cli`:
```sh
> 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
```sh
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 │
└───────────────┘
```
### To Reproduce
_No response_
### Expected behavior
_No response_
### Additional context
_No response_
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]