calciteGenPlan.getCluster().getPlanner().setExecutor(executorProvider);
basePlan.getCluster().getPlanner().setExecutor(executorProvider); planner.setExecutor(executorProvider);
basePlan.getCluster().getPlanner().setExecutor(executorProvider);
planner.setExecutor(new RexExecutorImpl(dataContext));
planner.setExecutor(new RexExecutorImpl(dataContext));
private void ready() { switch (state) { case STATE_0_CLOSED: reset(); } ensure(State.STATE_1_RESET); Frameworks.withPlanner( (cluster, relOptSchema, rootSchema) -> { Util.discard(rootSchema); // use our own defaultSchema typeFactory = (JavaTypeFactory) cluster.getTypeFactory(); planner = cluster.getPlanner(); planner.setExecutor(executor); return null; }, config); state = State.STATE_2_READY; // If user specify own traitDef, instead of default default trait, // first, clear the default trait def registered with planner // then, register the trait def specified in traitDefs. if (this.traitDefs != null) { planner.clearRelTraitDefs(); for (RelTraitDef def : this.traitDefs) { planner.addRelTraitDef(def); } } }
private void ready() { switch (state) { case STATE_0_CLOSED: reset(); } ensure(State.STATE_1_RESET); Frameworks.withPlanner( (cluster, relOptSchema, rootSchema) -> { Util.discard(rootSchema); // use our own defaultSchema typeFactory = (JavaTypeFactory) cluster.getTypeFactory(); planner = cluster.getPlanner(); planner.setExecutor(executor); return null; }, config); state = State.STATE_2_READY; // If user specify own traitDef, instead of default default trait, // first, clear the default trait def registered with planner // then, register the trait def specified in traitDefs. if (this.traitDefs != null) { planner.clearRelTraitDefs(); for (RelTraitDef def : this.traitDefs) { planner.addRelTraitDef(def); } } }
basePlan.getCluster().getPlanner().setExecutor(executor);
/** Test case for * <a href="https://issues.apache.org/jira/browse/CALCITE-566">[CALCITE-566] * ReduceExpressionsRule requires planner to have an Executor</a>. */ @Test public void testReduceConstantsRequiresExecutor() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .build(); // Remove the executor tester.convertSqlToRel("values 1").rel.getCluster().getPlanner() .setExecutor(null); // Rule should not fire, but there should be no NPE final String sql = "select * from (values (1,2)) where 1 + 2 > 3 + CAST(NULL AS INTEGER)"; checkPlanning(new HepPlanner(program), sql); }
/** Test case for * <a href="https://issues.apache.org/jira/browse/CALCITE-566">[CALCITE-566] * ReduceExpressionsRule requires planner to have an Executor</a>. */ @Test public void testReduceConstantsRequiresExecutor() throws Exception { HepProgram program = new HepProgramBuilder() .addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE) .build(); // Remove the executor tester.convertSqlToRel("values 1").rel.getCluster().getPlanner() .setExecutor(null); // Rule should not fire, but there should be no NPE final String sql = "select * from (values (1,2)) where 1 + 2 > 3 + CAST(NULL AS INTEGER)"; checkPlanning(new HepPlanner(program), sql); }
public RelNode run(RelOptPlanner planner, RelNode rel, RelTraitSet requiredOutputTraits, List<RelOptMaterialization> materializations, List<RelOptLattice> lattices) { planner.clear(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRelTraitDef(RelCollationTraitDef.INSTANCE); //((VolcanoPlanner) planner).registerAbstractRelationalRules(); RelOptUtil.registerAbstractRels(planner); for (RelOptRule rule : ruleSet) { planner.addRule(rule); } planner.addRule(Bindables.BINDABLE_TABLE_SCAN_RULE); planner.addRule(ProjectTableScanRule.INSTANCE); planner.addRule(ProjectTableScanRule.INTERPRETER); planner.addRule(EnumerableInterpreterRule.INSTANCE); final CalciteSchema rootSchema = CalciteSchema.from(context.getRootSchema()); planner.setExecutor(new RexExecutorImpl(null)); planner.setRoot(rel); MaterializationService.setThreadLocal(materializationService); plannerHolder.setPlanner(planner); populateMaterializationsAndLattice(plannerHolder, rootSchema); if (!rel.getTraitSet().equals(requiredOutputTraits)) { rel = planner.changeTraits(rel, requiredOutputTraits); planner.setRoot(rel); } RelOptPlanner planner2 = planner.chooseDelegate(); return planner2.findBestExp(); }