Class AggregateProjectPullUpConstantsRule

All Implemented Interfaces:
TransformationRule

@Enclosing public class AggregateProjectPullUpConstantsRule extends RelRule<AggregateProjectPullUpConstantsRule.Config> implements TransformationRule
Planner rule that removes constant keys from an Aggregate.

Constant fields are deduced using RelMetadataQuery.getPulledUpPredicates(RelNode); the input does not need to be a Project.

This rule never removes the last column, because Aggregate([]) returns 1 row even if its input is empty.

Since the transformed relational expression has to match the original relational expression, the constants are placed in a projection above the reduced aggregate. If those constants are not used, another rule will remove them from the project.