Java Code Examples for org.apache.calcite.plan.RelOptUtil#registerDefaultRules()
The following examples show how to use
org.apache.calcite.plan.RelOptUtil#registerDefaultRules() .
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: PlannerImpl.java From calcite with Apache License 2.0 | 5 votes |
private void ready() { switch (state) { case STATE_0_CLOSED: reset(); } ensure(State.STATE_1_RESET); RelDataTypeSystem typeSystem = connectionConfig.typeSystem(RelDataTypeSystem.class, RelDataTypeSystem.DEFAULT); typeFactory = new JavaTypeFactoryImpl(typeSystem); planner = new VolcanoPlanner(costFactory, context); RelOptUtil.registerDefaultRules(planner, connectionConfig.materializationsEnabled(), Hook.ENABLE_BINDABLE.get(false)); planner.setExecutor(executor); state = State.STATE_2_READY; // If user specify own traitDef, instead of default default trait, // register the trait def specified in traitDefs. if (this.traitDefs == null) { planner.addRelTraitDef(ConventionTraitDef.INSTANCE); if (CalciteSystemProperty.ENABLE_COLLATION_TRAIT.value()) { planner.addRelTraitDef(RelCollationTraitDef.INSTANCE); } } else { for (RelTraitDef def : this.traitDefs) { planner.addRelTraitDef(def); } } }
Example 2
Source File: MaterializedViewRelOptRulesTest.java From calcite with Apache License 2.0 | 5 votes |
protected List<RelNode> optimize(TestConfig testConfig) { RelNode queryRel = testConfig.queryRel; RelOptPlanner planner = queryRel.getCluster().getPlanner(); RelTraitSet traitSet = queryRel.getCluster().traitSet() .replace(EnumerableConvention.INSTANCE); RelOptUtil.registerDefaultRules(planner, true, false); return ImmutableList.of( Programs.standard().run( planner, queryRel, traitSet, testConfig.materializations, ImmutableList.of())); }
Example 3
Source File: TopDownOptTest.java From calcite with Apache License 2.0 | 5 votes |
private Query(String sql) { this.sql = sql; planner = new VolcanoPlanner(); // Always use top-down optimization planner.setTopDownOpt(true); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRelTraitDef(RelCollationTraitDef.INSTANCE); RelOptUtil.registerDefaultRules(planner, false, false); // Remove to Keep deterministic join order. planner.removeRule(JoinCommuteRule.INSTANCE); planner.removeRule(JoinPushThroughJoinRule.LEFT); planner.removeRule(JoinPushThroughJoinRule.RIGHT); // Always use sorted agg. planner.addRule(EnumerableRules.ENUMERABLE_SORTED_AGGREGATE_RULE); planner.removeRule(EnumerableRules.ENUMERABLE_AGGREGATE_RULE); // pushing down sort should be handled by top-down optimization. planner.removeRule(SortProjectTransposeRule.INSTANCE); // Sort will only be pushed down by traits propagation. planner.removeRule(SortJoinTransposeRule.INSTANCE); planner.removeRule(SortJoinCopyRule.INSTANCE); }