use of org.apache.calcite.plan.hep.HepProgram in project calcite by apache.
the class RelOptRulesTest method testAggregateProjectPullUpConstants2.
@Test
public void testAggregateProjectPullUpConstants2() {
final HepProgram preProgram = new HepProgramBuilder().addRuleInstance(AggregateProjectMergeRule.INSTANCE).build();
HepProgram program = new HepProgramBuilder().addRuleInstance(AggregateProjectPullUpConstantsRule.INSTANCE2).build();
final String sql = "select ename, sal\n" + "from (select '1', ename, sal from emp where ename = 'John') subq\n" + "group by ename, sal";
checkPlanning(tester, preProgram, new HepPlanner(program), sql);
}
use of org.apache.calcite.plan.hep.HepProgram in project calcite by apache.
the class RelOptRulesTest method testRemoveSemiJoinRightWithFilter.
@Test
public void testRemoveSemiJoinRightWithFilter() throws Exception {
HepProgram program = new HepProgramBuilder().addRuleInstance(FilterJoinRule.FILTER_ON_JOIN).addRuleInstance(JoinAddRedundantSemiJoinRule.INSTANCE).addRuleInstance(SemiJoinJoinTransposeRule.INSTANCE).addRuleInstance(SemiJoinFilterTransposeRule.INSTANCE).addRuleInstance(SemiJoinRemoveRule.INSTANCE).build();
checkPlanning(program, "select e1.ename from emp e1, dept d, emp e2 " + "where e1.deptno = d.deptno and d.deptno = e2.deptno " + "and d.name = 'foo'");
}
use of org.apache.calcite.plan.hep.HepProgram in project calcite by apache.
the class RelOptRulesTest method testEmptyJoinLeft.
@Test
public void testEmptyJoinLeft() {
HepProgram program = new HepProgramBuilder().addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE).addRuleInstance(PruneEmptyRules.PROJECT_INSTANCE).addRuleInstance(PruneEmptyRules.JOIN_LEFT_INSTANCE).addRuleInstance(PruneEmptyRules.JOIN_RIGHT_INSTANCE).build();
// Plan should be empty
checkPlanning(program, "select * from (\n" + "select * from emp where false)\n" + "left join dept using (deptno)");
}
use of org.apache.calcite.plan.hep.HepProgram in project calcite by apache.
the class RelOptRulesTest method testReduceConstantsIsNotNull.
@Test
public void testReduceConstantsIsNotNull() throws Exception {
HepProgram program = new HepProgramBuilder().addRuleInstance(ReduceExpressionsRule.FILTER_INSTANCE).build();
final String sql = "select empno from emp\n" + "where empno=10 and empno is not null";
checkPlanning(program, sql);
}
use of org.apache.calcite.plan.hep.HepProgram in project calcite by apache.
the class RelOptRulesTest method testSortProjectTranspose3.
@Test
public void testSortProjectTranspose3() {
final HepProgram program = new HepProgramBuilder().addRuleInstance(SortProjectTransposeRule.INSTANCE).build();
// This one cannot be pushed down
final String sql = "select d.deptno from sales.dept d\n" + "order by cast(d.deptno as varchar(10)) offset 1";
sql(sql).with(program).checkUnchanged();
}
Aggregations