Search in sources :

Example 1 with ProjectMultiJoinMergeRule

use of org.apache.calcite.rel.rules.ProjectMultiJoinMergeRule in project calcite by apache.

the class RelOptRulesTest method testFilterAndProjectWithMultiJoin.

@Test
void testFilterAndProjectWithMultiJoin() {
    final HepProgram preProgram = new HepProgramBuilder().addRuleCollection(Arrays.asList(MyFilterRule.INSTANCE, MyProjectRule.INSTANCE)).build();
    final FilterMultiJoinMergeRule filterMultiJoinMergeRule = FilterMultiJoinMergeRule.Config.DEFAULT.withOperandFor(MyFilter.class, MultiJoin.class).toRule();
    final ProjectMultiJoinMergeRule projectMultiJoinMergeRule = ProjectMultiJoinMergeRule.Config.DEFAULT.withOperandFor(MyProject.class, MultiJoin.class).toRule();
    HepProgram program = new HepProgramBuilder().addRuleCollection(Arrays.asList(CoreRules.JOIN_TO_MULTI_JOIN, filterMultiJoinMergeRule, projectMultiJoinMergeRule)).build();
    sql("select * from emp e1 left outer join dept d on e1.deptno = d.deptno where d.deptno > 3").withPre(preProgram).withProgram(program).check();
}
Also used : HepProgram(org.apache.calcite.plan.hep.HepProgram) ProjectMultiJoinMergeRule(org.apache.calcite.rel.rules.ProjectMultiJoinMergeRule) HepProgramBuilder(org.apache.calcite.plan.hep.HepProgramBuilder) FilterMultiJoinMergeRule(org.apache.calcite.rel.rules.FilterMultiJoinMergeRule) MultiJoin(org.apache.calcite.rel.rules.MultiJoin) Test(org.junit.jupiter.api.Test)

Aggregations

HepProgram (org.apache.calcite.plan.hep.HepProgram)1 HepProgramBuilder (org.apache.calcite.plan.hep.HepProgramBuilder)1 FilterMultiJoinMergeRule (org.apache.calcite.rel.rules.FilterMultiJoinMergeRule)1 MultiJoin (org.apache.calcite.rel.rules.MultiJoin)1 ProjectMultiJoinMergeRule (org.apache.calcite.rel.rules.ProjectMultiJoinMergeRule)1 Test (org.junit.jupiter.api.Test)1