private void ready() { if (this.traitDefs != null) { this.planner.clearRelTraitDefs(); for (RelTraitDef traitDef : this.traitDefs) { this.planner.addRelTraitDef(traitDef); } } }
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); } } }
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(); }
planner.addRelTraitDef(RelCollationTraitDef.INSTANCE); planner.addRelTraitDef(ConventionTraitDef.INSTANCE);
planner.addRelTraitDef(RelCollationTraitDef.INSTANCE); planner.addRelTraitDef(ConventionTraitDef.INSTANCE);