Skip to content

Execution panic for valid 64-column GROUPING SETS #26134

Description

@alexandrefimov

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.

Activity

  1. siddubakka commented on Oct 8, 2026

    @siddubakka

    take

  2. changed the title [-]Panic with 64-column GROUPING SETS[/-] [+]Execution panic for valid 64-column GROUPING SETS[/+] on Oct 8, 2026
  3. alexandrefimov commented on Oct 8, 2026

    @alexandrefimov
    ContributorAuthor

    A fix is already in PR #26136. Thanks for offering to help.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions