org.apache.calcite.tools.RelBuilderFactory Java Examples
The following examples show how to use
org.apache.calcite.tools.RelBuilderFactory.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProjectFilterTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a ProjectFilterTransposeRule. * * @param preserveExprCondition Condition for expressions that should be * preserved in the projection */ public ProjectFilterTransposeRule( Class<? extends Project> projectClass, Class<? extends Filter> filterClass, RelBuilderFactory relBuilderFactory, PushProjector.ExprCondition preserveExprCondition) { this( operand( projectClass, operand(filterClass, any())), preserveExprCondition, relBuilderFactory); }
Example #2
Source File: StreamRules.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a DeltaSortTransposeRule. * * @param relBuilderFactory Builder for relational expressions */ public DeltaSortTransposeRule(RelBuilderFactory relBuilderFactory) { super( operand(Delta.class, operand(Sort.class, any())), relBuilderFactory, null); }
Example #3
Source File: AbstractMaterializedViewRule.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a MaterializedViewJoinRule. */ protected MaterializedViewJoinRule(RelOptRuleOperand operand, RelBuilderFactory relBuilderFactory, String description, boolean generateUnionRewriting, HepProgram unionRewritingPullProgram, boolean fastBailOut) { super(operand, relBuilderFactory, description, generateUnionRewriting, unionRewritingPullProgram, fastBailOut); }
Example #4
Source File: AggregateValuesRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates an AggregateValuesRule. * * @param relBuilderFactory Builder for relational expressions */ public AggregateValuesRule(RelBuilderFactory relBuilderFactory) { super( operandJ(Aggregate.class, null, aggregate -> aggregate.getGroupCount() == 0, operandJ(Values.class, null, values -> values.getTuples().isEmpty(), none())), relBuilderFactory, null); }
Example #5
Source File: PruneEmptyRules.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a RemoveEmptySingleRule. */ public <R extends SingleRel> RemoveEmptySingleRule(Class<R> clazz, Predicate<R> predicate, RelBuilderFactory relBuilderFactory, String description) { super( operandJ(clazz, null, predicate, operandJ(Values.class, null, Values::isEmpty, none())), relBuilderFactory, description); }
Example #6
Source File: ProjectSortTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a ProjectSortTransposeRule. */ private ProjectSortTransposeRule(Class<Project> projectClass, Class<Sort> sortClass, RelBuilderFactory relBuilderFactory) { this( operand(projectClass, operand(sortClass, any())), relBuilderFactory, null); }
Example #7
Source File: FilterTableFunctionTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a FilterTableFunctionTransposeRule. */ public FilterTableFunctionTransposeRule(RelBuilderFactory relBuilderFactory) { super( operand(LogicalFilter.class, operand(LogicalTableFunctionScan.class, any())), relBuilderFactory, null); }
Example #8
Source File: FilterProjectTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a FilterProjectTransposeRule. * * <p>If {@code copyFilter} is true, creates the same kind of Filter as * matched in the rule, otherwise it creates a Filter using the RelBuilder * obtained by the {@code relBuilderFactory}. * Similarly for {@code copyProject}. * * <p>Defining predicates for the Filter (using {@code filterPredicate}) * and/or the Project (using {@code projectPredicate} allows making the rule * more restrictive. */ public <F extends Filter, P extends Project> FilterProjectTransposeRule( Class<F> filterClass, Predicate<? super F> filterPredicate, Class<P> projectClass, Predicate<? super P> projectPredicate, boolean copyFilter, boolean copyProject, RelBuilderFactory relBuilderFactory) { this( operandJ(filterClass, null, filterPredicate, operandJ(projectClass, null, projectPredicate, any())), copyFilter, copyProject, relBuilderFactory); }
Example #9
Source File: FilterProjectTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
protected FilterProjectTransposeRule( RelOptRuleOperand operand, boolean copyFilter, boolean copyProject, RelBuilderFactory relBuilderFactory) { super(operand, relBuilderFactory, null); this.copyFilter = copyFilter; this.copyProject = copyProject; }
Example #10
Source File: CoerceInputsRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a CoerceInputsRule. * * @param consumerRelClass Class of RelNode that will consume the inputs * @param coerceNames If true, coerce names and types; if false, coerce * type only * @param relBuilderFactory Builder for relational expressions */ public CoerceInputsRule(Class<? extends RelNode> consumerRelClass, boolean coerceNames, RelBuilderFactory relBuilderFactory) { super( operand(consumerRelClass, any()), relBuilderFactory, "CoerceInputsRule:" + consumerRelClass.getName()); this.consumerRelClass = consumerRelClass; this.coerceNames = coerceNames; }
Example #11
Source File: AggregateUnionTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** Creates an AggregateUnionTransposeRule. */ public AggregateUnionTransposeRule(Class<? extends Aggregate> aggregateClass, Class<? extends Union> unionClass, RelBuilderFactory relBuilderFactory) { super( operand(aggregateClass, operand(unionClass, any())), relBuilderFactory, null); }
Example #12
Source File: ProjectCalcMergeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a ProjectCalcMergeRule. * * @param relBuilderFactory Builder for relational expressions */ public ProjectCalcMergeRule(RelBuilderFactory relBuilderFactory) { super( operand( LogicalProject.class, operand(LogicalCalc.class, any())), relBuilderFactory, null); }
Example #13
Source File: SemiJoinProjectTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a SemiJoinProjectTransposeRule. */ private SemiJoinProjectTransposeRule(RelBuilderFactory relBuilderFactory) { super( operand(SemiJoin.class, some(operand(LogicalProject.class, any()))), relBuilderFactory, null); }
Example #14
Source File: SemiJoinJoinTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a SemiJoinJoinTransposeRule. */ public SemiJoinJoinTransposeRule(RelBuilderFactory relBuilderFactory) { super( operand(SemiJoin.class, some(operand(Join.class, any()))), relBuilderFactory, null); }
Example #15
Source File: SortJoinTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a SortJoinTransposeRule. */ public SortJoinTransposeRule(Class<? extends Sort> sortClass, Class<? extends Join> joinClass, RelBuilderFactory relBuilderFactory) { super( operand(sortClass, operand(joinClass, any())), relBuilderFactory, null); }
Example #16
Source File: FlinkAggregateRemoveRule.java From flink with Apache License 2.0 | 5 votes |
/** * Creates an FlinkAggregateRemoveRule. */ public FlinkAggregateRemoveRule(Class<? extends Aggregate> aggregateClass, RelBuilderFactory relBuilderFactory) { // REVIEW jvs 14-Mar-2006: We have to explicitly mention the child here // to make sure the rule re-fires after the child changes (e.g. via // ProjectRemoveRule), since that may change our information // about whether the child is distinct. If we clean up the inference of // distinct to make it correct up-front, we can get rid of the reference // to the child here. super( operand(aggregateClass, operand(RelNode.class, any())), relBuilderFactory, null); }
Example #17
Source File: ProjectSetOpTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a ProjectSetOpTransposeRule with an explicit condition whether * to preserve expressions. * * @param preserveExprCondition Condition whether to preserve expressions */ public ProjectSetOpTransposeRule( PushProjector.ExprCondition preserveExprCondition, RelBuilderFactory relBuilderFactory) { super( operand( LogicalProject.class, operand(SetOp.class, any())), relBuilderFactory, null); this.preserveExprCondition = preserveExprCondition; }
Example #18
Source File: JoinAssociateRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a JoinAssociateRule. */ public JoinAssociateRule(RelBuilderFactory relBuilderFactory) { super( operand(Join.class, operand(Join.class, any()), operand(RelSubset.class, any())), relBuilderFactory, null); }
Example #19
Source File: FlinkFilterJoinRule.java From flink with Apache License 2.0 | 5 votes |
/** * Creates a FilterProjectTransposeRule with an explicit root operand and * factories. */ protected FlinkFilterJoinRule(RelOptRuleOperand operand, String id, boolean smart, RelBuilderFactory relBuilderFactory, Predicate predicate) { super(operand, relBuilderFactory, "FlinkFilterJoinRule:" + id); this.smart = smart; this.predicate = Objects.requireNonNull(predicate); }
Example #20
Source File: RelDecorrelator.java From Bats with Apache License 2.0 | 5 votes |
RemoveCorrelationForScalarAggregateRule(RelBuilderFactory relBuilderFactory) { super(operand(LogicalCorrelate.class, operand(RelNode.class, any()), operand(LogicalProject.class, operandJ(LogicalAggregate.class, null, Aggregate::isSimple, operand(LogicalProject.class, operand(RelNode.class, any()))))), relBuilderFactory, null); }
Example #21
Source File: DrillRelBuilder.java From Bats with Apache License 2.0 | 5 votes |
/** Creates a {@link RelBuilderFactory}, a partially-created DrillRelBuilder. * Just add a {@link RelOptCluster} and a {@link RelOptSchema} */ public static RelBuilderFactory proto(final Context context) { return new RelBuilderFactory() { public RelBuilder create(RelOptCluster cluster, RelOptSchema schema) { return new DrillRelBuilder(context, cluster, schema); } }; }
Example #22
Source File: FilterSetOpTransposeRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a FilterSetOpTransposeRule. */ public FilterSetOpTransposeRule(RelBuilderFactory relBuilderFactory) { super( operand(Filter.class, operand(SetOp.class, any())), relBuilderFactory, null); }
Example #23
Source File: FlinkAggregateExpandDistinctAggregatesRule.java From flink with Apache License 2.0 | 5 votes |
public FlinkAggregateExpandDistinctAggregatesRule( Class<? extends Aggregate> clazz, boolean useGroupingSets, RelBuilderFactory relBuilderFactory) { super(operand(clazz, any()), relBuilderFactory, null); this.useGroupingSets = useGroupingSets; }
Example #24
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
public RelNode removeCorrelationViaRule(RelNode root) { final RelBuilderFactory f = relBuilderFactory(); HepProgram program = HepProgram.builder() .addRuleInstance(new RemoveSingleAggregateRule(f)) .addRuleInstance(new RemoveCorrelationForScalarProjectRule(f)) .addRuleInstance(new RemoveCorrelationForScalarAggregateRule(f)) .build(); HepPlanner planner = createPlanner(program); planner.setRoot(root); return planner.findBestExp(); }
Example #25
Source File: AggregateProjectMergeRule.java From Bats with Apache License 2.0 | 5 votes |
public AggregateProjectMergeRule( Class<? extends Aggregate> aggregateClass, Class<? extends Project> projectClass, RelBuilderFactory relBuilderFactory) { super( operand(aggregateClass, operand(projectClass, any())), relBuilderFactory, null); }
Example #26
Source File: JoinToMultiJoinRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a JoinToMultiJoinRule. */ public JoinToMultiJoinRule(Class<? extends Join> clazz, RelBuilderFactory relBuilderFactory) { super( operand(clazz, operand(RelNode.class, any()), operand(RelNode.class, any())), relBuilderFactory, null); }
Example #27
Source File: JoinPushThroughJoinRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a JoinPushThroughJoinRule. */ public JoinPushThroughJoinRule(String description, boolean right, Class<? extends Join> clazz, RelBuilderFactory relBuilderFactory) { super( operand(clazz, operand(clazz, any()), operand(RelNode.class, any())), relBuilderFactory, description); this.right = right; }
Example #28
Source File: FlinkFilterJoinRule.java From flink with Apache License 2.0 | 5 votes |
/** * Creates a FilterProjectTransposeRule with an explicit root operand and * factories. */ protected FlinkFilterJoinRule(RelOptRuleOperand operand, String id, boolean smart, RelBuilderFactory relBuilderFactory, Predicate predicate) { super(operand, relBuilderFactory, "FlinkFilterJoinRule:" + id); this.smart = smart; this.predicate = Objects.requireNonNull(predicate); }
Example #29
Source File: FilterJoinRule.java From Bats with Apache License 2.0 | 5 votes |
/** * Creates a FilterProjectTransposeRule with an explicit root operand and * factories. */ protected FilterJoinRule(RelOptRuleOperand operand, String id, boolean smart, RelBuilderFactory relBuilderFactory, Predicate predicate) { super(operand, relBuilderFactory, "FilterJoinRule:" + id); this.smart = smart; this.predicate = Objects.requireNonNull(predicate); }
Example #30
Source File: RelDecorrelator.java From flink with Apache License 2.0 | 5 votes |
RemoveCorrelationForScalarProjectRule(RelBuilderFactory relBuilderFactory) { super( operand(LogicalCorrelate.class, operand(RelNode.class, any()), operand(LogicalAggregate.class, operand(LogicalProject.class, operand(RelNode.class, any())))), relBuilderFactory, null); }