alexandrefimov opened a new issue, #26135:
URL: https://github.com/apache/datafusion/issues/26135
### Describe the bug
GROUPING can panic during analysis of GROUPING SETS with 65 distinct
grouping columns, even when GROUPING has only one argument.
The analyzer constructs the mask using `1 << group_by_idx`. A column at bit
64 causes a shift overflow in a checked build. The physical grouping-set
representation already has a 64-bit capacity limit.
### To reproduce
Generate the SQL below and run its output in a debug DataFusion CLI:
```python
n = 65
cols = ", ".join(f"c{i} INTEGER" for i in range(n))
keys = ", ".join(f"c{i}" for i in range(n))
row = ", ".join(str(i + 1) for i in range(n))
print(f"CREATE TABLE wide_keys ({cols});")
print(f"INSERT INTO wide_keys VALUES ({row});")
print(f"SELECT GROUPING(c0), COUNT(*) FROM wide_keys "
f"GROUP BY GROUPING SETS (({keys}), ());")
```
### Expected behavior
Return NotImplemented before constructing an unrepresentable grouping-set
mask. Ordinary GROUP BY with 65 columns should continue to allow GROUPING to
return zero.
### Additional context
Reproduced through core API regression tests on commit
`1fa378d380fa7e494aae1085945f8b048e9376c3`. A fix and regression tests are
prepared locally; qualification on the newer main base is still running.
--
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]