@Override public boolean matches(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); // Rule cannot be applied if there are GroupingSets if (aggregate.indicator) { return false; } return super.matches(call); }
/** * Creates an AggregateProjectPullUpConstantsRule. * * @param aggregateClass Aggregate class * @param inputClass Input class, such as {@link LogicalProject} * @param relBuilderFactory Builder for relational expressions * @param description Description, or null to guess description */ public AggregateProjectPullUpConstantsRule( Class<? extends Aggregate> aggregateClass, Class<? extends RelNode> inputClass, RelBuilderFactory relBuilderFactory, String description) { super( operandJ(aggregateClass, null, Aggregate::isSimple, operand(inputClass, any())), relBuilderFactory, description); }
/** Creates a MaterializedViewAggregateRule. */ protected MaterializedViewAggregateRule(RelOptRuleOperand operand, RelBuilderFactory relBuilderFactory, String description, boolean generateUnionRewriting, HepProgram unionRewritingPullProgram) { super(operand, relBuilderFactory, description, generateUnionRewriting, unionRewritingPullProgram, false); this.filterProjectTransposeRule = new FilterProjectTransposeRule( Filter.class, Project.class, true, true, relBuilderFactory); this.filterAggregateTransposeRule = new FilterAggregateTransposeRule( Filter.class, relBuilderFactory, Aggregate.class); this.aggregateProjectPullUpConstantsRule = new AggregateProjectPullUpConstantsRule( Aggregate.class, Filter.class, relBuilderFactory, "AggFilterPullUpConstants"); this.projectMergeRule = new ProjectMergeRule(true, relBuilderFactory); }
/** * Creates an AggregateProjectPullUpConstantsRule. * * @param aggregateClass Aggregate class * @param inputClass Input class, such as {@link LogicalProject} * @param relBuilderFactory Builder for relational expressions * @param description Description, or null to guess description */ public AggregateProjectPullUpConstantsRule( Class<? extends Aggregate> aggregateClass, Class<? extends RelNode> inputClass, RelBuilderFactory relBuilderFactory, String description) { super( operandJ(aggregateClass, null, Aggregate::isSimple, operand(inputClass, any())), relBuilderFactory, description); }
/** Creates a MaterializedViewAggregateRule. */ protected MaterializedViewAggregateRule(RelOptRuleOperand operand, RelBuilderFactory relBuilderFactory, String description, boolean generateUnionRewriting, HepProgram unionRewritingPullProgram) { super(operand, relBuilderFactory, description, generateUnionRewriting, unionRewritingPullProgram, false); this.filterProjectTransposeRule = new FilterProjectTransposeRule( Filter.class, Project.class, true, true, relBuilderFactory); this.filterAggregateTransposeRule = new FilterAggregateTransposeRule( Filter.class, relBuilderFactory, Aggregate.class); this.aggregateProjectPullUpConstantsRule = new AggregateProjectPullUpConstantsRule( Aggregate.class, Filter.class, relBuilderFactory, "AggFilterPullUpConstants"); this.projectMergeRule = new ProjectMergeRule(true, relBuilderFactory); }
@Override public boolean matches(RelOptRuleCall call) { final Aggregate aggregate = call.rel(0); // Rule cannot be applied if there are GroupingSets if (aggregate.getGroupType() != Group.SIMPLE) { return false; } return super.matches(call); }