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
Reject oversized GROUPING masks during analysis #26135
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:
n=65cols=", ".join(f"c{i} INTEGER"foriinrange(n))
keys=", ".join(f"c{i}"foriinrange(n))
row=", ".join(str(i+1) foriinrange(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.
Hi @alexandrefimov, I'd like to work on this issue. I saw that you already have a fix and regression tests prepared locally. If the issue is still available, I'd be happy to take it up and work on the fix/tests. Could you assign it to me?
Activity
aryan9948 commentedon Oct 8, 2026
Hi @alexandrefimov, I'd like to work on this issue. I saw that you already have a fix and regression tests prepared locally. If the issue is still available, I'd be happy to take it up and work on the fix/tests. Could you assign it to me?
[-]GROUPING can panic with 65 grouping columns[/-][+]Reject oversized GROUPING masks during analysis[/+]alexandrefimov commentedon Oct 8, 2026
A fix is already in PR #26137. Thanks for offering to help.