use of org.apache.calcite.rel.rules.FilterJoinRule in project calcite by apache.
the class RelOptRulesTest method testPushFilterPastProject.
/**
* Test case for
* <a href="https://issues.apache.org/jira/browse/CALCITE-448">[CALCITE-448]
* FilterIntoJoinRule creates filters containing invalid RexInputRef</a>.
*/
@Test
public void testPushFilterPastProject() {
final HepProgram preProgram = HepProgram.builder().addRuleInstance(ProjectMergeRule.INSTANCE).build();
final FilterJoinRule.Predicate predicate = new FilterJoinRule.Predicate() {
public boolean apply(Join join, JoinRelType joinType, RexNode exp) {
return joinType != JoinRelType.INNER;
}
};
final FilterJoinRule join = new FilterJoinRule.JoinConditionPushRule(RelBuilder.proto(), predicate);
final FilterJoinRule filterOnJoin = new FilterJoinRule.FilterIntoJoinRule(true, RelBuilder.proto(), predicate);
final HepProgram program = HepProgram.builder().addGroupBegin().addRuleInstance(FilterProjectTransposeRule.INSTANCE).addRuleInstance(join).addRuleInstance(filterOnJoin).addGroupEnd().build();
final String sql = "select a.name\n" + "from dept a\n" + "left join dept b on b.deptno > 10\n" + "right join dept c on b.deptno > 10\n";
checkPlanning(tester, preProgram, new HepPlanner(program), sql);
}
Aggregations