Class AggregateProjectPullUpConstantsRule


  • public class AggregateProjectPullUpConstantsRule
    extends RelOptRule
    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 rules 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.