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:
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.
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_arraypacks the duplicate ordinal usingordinal << n. With 64 columns and ordinal zero, this evaluates0u64 << 64and 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:
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.