Class PruneGroupIdColumns

  • All Implemented Interfaces:
    Rule<ProjectNode>

    public class PruneGroupIdColumns
    extends ProjectOffPushDownRule<GroupIdNode>
    This rule prunes GroupIdNode's aggregationArguments.

    Transforms:

     - Project (a, key_1, key_2, group_id)
          - GroupId
              grouping sets: ((key_1), (key_2))
              aggregation arguments: (a, b)
              group id symbol: group_id
               - Source (a, b, key_1, key_2)
     
    Into:
     - Project (a, key_1, key_2, group_id)
          - GroupId
              grouping sets: ((key_1), (key_2))
              aggregation arguments: (a)
              group id symbol: group_id
               - Source (a, b, key_1, key_2)
     
    Note: this rule does not prune any grouping symbols. Currently, GroupIdNode is only used in regard to AggregationNode. The presence of an AggregationNode in the plan ensures that the grouping symbols are referenced. This rule could be extended to prune grouping symbols.

    Note: after pruning an aggregation argument, the child node of the GroupIdNode becomes eligible for symbol pruning. That is performed by the rule PruneGroupIdSourceColumns.