.addRuleInstance(PushFilterPastJoinRule.DUMB_FILTER_ON_JOIN)
.addRuleInstance(PushFilterPastJoinRule.JOIN)
.addRuleInstance(PushFilterPastProjectRule.INSTANCE)
.addRuleInstance(PushFilterPastSetOpRule.INSTANCE)
.build();
HepPlanner planner = new HepPlanner(program);
RelNode relInitial = tester.convertSqlToRel(sql);
assertTrue(relInitial != null);
List<RelMetadataProvider> list = Lists.newArrayList();
DefaultRelMetadataProvider defaultProvider =
new DefaultRelMetadataProvider();
list.add(defaultProvider);
planner.registerMetadataProviders(list);
RelMetadataProvider plannerChain = ChainedRelMetadataProvider.of(list);
relInitial.getCluster().setMetadataProvider(
new CachingRelMetadataProvider(plannerChain, planner));
planner.setRoot(relInitial);
RelNode relAfter = planner.findBestExp();
String planBefore = NL + RelOptUtil.toString(relAfter);
diffRepos.assertEquals("planBefore", "${planBefore}", planBefore);
HepProgram program2 = new HepProgramBuilder()
.addMatchOrder(HepMatchOrder.BOTTOM_UP)
.addRuleInstance(PushFilterPastJoinRule.DUMB_FILTER_ON_JOIN)
.addRuleInstance(PushFilterPastJoinRule.JOIN)
.addRuleInstance(PushFilterPastProjectRule.INSTANCE)
.addRuleInstance(PushFilterPastSetOpRule.INSTANCE)
.addRuleInstance(TransitivePredicatesOnJoinRule.INSTANCE)
.build();
HepPlanner planner2 = new HepPlanner(program2);
planner.registerMetadataProviders(list);
planner2.setRoot(relAfter);
relAfter = planner2.findBestExp();
String planAfter = NL + RelOptUtil.toString(relAfter);
diffRepos.assertEquals("planAfter", "${planAfter}", planAfter);
}