Skip to content

Support grouping() and grouping_id() indicator functions #4814

Description

@andygrove

The grouping() and grouping_id() indicator functions used with ROLLUP, CUBE, and GROUPING SETS are currently marked as unsupported (🔜) in the expressions guide.

These are Unevaluable expressions that Spark's analyzer rewrites before physical planning:

  • grouping(col) becomes Cast(BitwiseAnd(ShiftRight(spark_grouping_id, n-1-i), 1L), ByteType)
  • grouping_id() becomes a reference to the spark_grouping_id virtual column

All of the constituent pieces (the ExpandExec operator plus Cast, BitwiseAnd, ShiftRight, and Literal) are already supported by Comet, so these queries already run natively end-to-end. This issue tracks adding test coverage and marking the functions as supported.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions