alexandrefimov opened a new issue, #26134:
URL: https://github.com/apache/datafusion/issues/26134

   ### Describe the bug
   
   A GROUPING SETS query with 64 distinct grouping columns can panic during 
execution, even when no grouping set is repeated.
   
   `group_id_array` packs the duplicate ordinal using `ordinal << n`. With 64 
columns and ordinal zero, this evaluates `0u64 << 64` and panics in a checked 
build. The layout itself fits UInt64.
   
   ### To reproduce
   
   Generate the SQL below and run its output in a debug DataFusion CLI:
   
   ```python
   n = 64
   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 COUNT(*) FROM wide_keys "
         f"GROUP BY GROUPING SETS (({keys}), ());")
   ```
   
   ### Expected behavior
   
   The query should return two rows, each with COUNT(*) = 1. Layouts requiring 
more than 64 total bits should continue to return NotImplemented.
   
   ### Additional context
   
   The shift overflow is confirmed by focused regression tests on commit 
`102a1628592121d96bfe3d09d80e63180eef288a`. A fix and regression tests are 
prepared locally; full qualification 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]

Reply via email to