public void registerAbstractRelationalRules() { addRule(AbstractConverter.ExpandConversionRule.instance); addRule(SwapJoinRule.instance); addRule(RemoveDistinctRule.instance); addRule(UnionToDistinctRule.instance); addRule(RemoveTrivialProjectRule.instance); addRule(RemoveTrivialCalcRule.instance); addRule(RemoveSortRule.INSTANCE); // todo: rule which makes Project({OrdinalRef}) disappear }
public void registerAbstractRelationalRules() { addRule(PushFilterPastJoinRule.FILTER_ON_JOIN); addRule(PushFilterPastJoinRule.JOIN); addRule(AbstractConverter.ExpandConversionRule.INSTANCE); addRule(SwapJoinRule.INSTANCE); addRule(SemiJoinRule.INSTANCE); if (OptiqPrepareImpl.COMMUTE) { addRule(CommutativeJoinRule.INSTANCE); } addRule(RemoveDistinctRule.INSTANCE); addRule(UnionToDistinctRule.INSTANCE); addRule(RemoveTrivialProjectRule.INSTANCE); addRule(RemoveTrivialCalcRule.INSTANCE); addRule(RemoveSortRule.INSTANCE); // todo: rule which makes Project({OrdinalRef}) disappear }
planner.addRule(JavaRules.ENUMERABLE_JOIN_RULE); planner.addRule(JavaRules.ENUMERABLE_CALC_RULE); planner.addRule(JavaRules.ENUMERABLE_AGGREGATE_RULE); planner.addRule(JavaRules.ENUMERABLE_SORT_RULE); planner.addRule(JavaRules.ENUMERABLE_LIMIT_RULE); planner.addRule(JavaRules.ENUMERABLE_UNION_RULE); planner.addRule(JavaRules.ENUMERABLE_INTERSECT_RULE); planner.addRule(JavaRules.ENUMERABLE_MINUS_RULE); planner.addRule(JavaRules.ENUMERABLE_TABLE_MODIFICATION_RULE); planner.addRule(JavaRules.ENUMERABLE_VALUES_RULE); planner.addRule(JavaRules.ENUMERABLE_WINDOW_RULE); planner.addRule(JavaRules.ENUMERABLE_ONE_ROW_RULE); planner.addRule(TableAccessRule.instance); planner.addRule(PushFilterPastProjectRule.instance); planner.addRule(PushFilterPastJoinRule.instance); planner.addRule(RemoveDistinctAggregateRule.instance); planner.addRule(ReduceAggregatesRule.instance); planner.addRule(SwapJoinRule.instance); planner.addRule(WindowedAggSplitterRule.INSTANCE); return planner;
/** * Creates a simple planner that can plan "select * from myTable" but not * much more. */ protected RelOptPlanner createTapPlanner() { final VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef( Cascading.CONVENTION.getTraitDef() ); planner.addRelTraitDef( ConventionTraitDef.instance ); planner.addRule( TableAccessRule.instance ); planner.addRule( JavaRules.ENUMERABLE_CALC_RULE ); planner.addRule( ProjectToCalcRule.instance ); planner.addRule( EnumerableTapRule.INSTANCE ); planner.setLocked( true ); // prevent further rules being added return planner; } }
/** * Tests transformation of a single+leaf from NONE to PHYS. */ @Test public void testTransformSingleGood() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRule(new PhysLeafRule()); planner.addRule(new GoodSingleRule()); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); NoneSingleRel singleRel = new NoneSingleRel( cluster, leafRel); RelNode convertedRel = planner.changeTraits( singleRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); RelNode result = planner.chooseDelegate().findBestExp(); assertTrue(result instanceof PhysSingleRel); }
/** * Tests transformation of a single+leaf from NONE to PHYS. In the past, * this one didn't work due to the definition of ReformedSingleRule. */ @Test public void testTransformSingleReformed() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.instance); planner.addRule(new PhysLeafRule()); planner.addRule(new ReformedSingleRule()); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); NoneSingleRel singleRel = new NoneSingleRel( cluster, leafRel); RelNode convertedRel = planner.changeTraits( singleRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); RelNode result = planner.chooseDelegate().findBestExp(); assertTrue(result instanceof PhysSingleRel); }
/** * Tests transformation of a single+leaf from NONE to PHYS. */ @Test public void testTransformSingleGood() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.instance); planner.addRule(new PhysLeafRule()); planner.addRule(new GoodSingleRule()); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); NoneSingleRel singleRel = new NoneSingleRel( cluster, leafRel); RelNode convertedRel = planner.changeTraits( singleRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); RelNode result = planner.chooseDelegate().findBestExp(); assertTrue(result instanceof PhysSingleRel); }
/** * Tests transformation of a single+leaf from NONE to PHYS. In the past, * this one didn't work due to the definition of ReformedSingleRule. */ @Ignore // broken, because ReformedSingleRule matches child traits strictly @Test public void testTransformSingleReformed() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRule(new PhysLeafRule()); planner.addRule(new ReformedSingleRule()); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); NoneSingleRel singleRel = new NoneSingleRel( cluster, leafRel); RelNode convertedRel = planner.changeTraits( singleRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); RelNode result = planner.chooseDelegate().findBestExp(); assertTrue(result instanceof PhysSingleRel); }
/** * Tests transformation of a leaf from NONE to PHYS. */ @Test public void testTransformLeaf() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.instance); planner.addRule(new PhysLeafRule()); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); RelNode convertedRel = planner.changeTraits( leafRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); RelNode result = planner.chooseDelegate().findBestExp(); assertTrue(result instanceof PhysLeafRel); }
/** * Tests transformation of a leaf from NONE to PHYS. */ @Test public void testTransformLeaf() { VolcanoPlanner planner = new VolcanoPlanner(); planner.addRelTraitDef(ConventionTraitDef.INSTANCE); planner.addRule(new PhysLeafRule()); RelOptCluster cluster = newCluster(planner); NoneLeafRel leafRel = new NoneLeafRel( cluster, "a"); RelNode convertedRel = planner.changeTraits( leafRel, cluster.traitSetOf(PHYS_CALLING_CONVENTION)); planner.setRoot(convertedRel); RelNode result = planner.chooseDelegate().findBestExp(); assertTrue(result instanceof PhysLeafRel); }