vlsi commented on a change in pull request #2252:
URL: https://github.com/apache/calcite/pull/2252#discussion_r602842213
##########
File path: core/src/test/java/org/apache/calcite/test/SqlToRelConverterTest.java
##########
@@ -2349,6 +2349,27 @@ public final Sql sql(String sql) {
assertThat(rels.get(0), isA(LogicalCalc.class));
}
+ @Test void testRelShuttleForLogicalCalcShuttle() {
+ final String sql = "select count(ename) from emp";
+ final RelNode rel = tester.convertSqlToRel(sql).rel;
+ final HepProgramBuilder programBuilder = HepProgram.builder();
+ programBuilder.addRuleInstance(CoreRules.PROJECT_TO_CALC);
+ final HepPlanner planner = new HepPlanner(programBuilder.build());
+ planner.setRoot(rel);
+ final RelNode calc = planner.findBestExp();
+ final List<RelNode> rels = new ArrayList<>();
+ final RelShuttleImpl visitor = new RelShuttleImpl() {
+ @Override public RelNode visit(LogicalCalc calc) {
+ RelNode visitedRel = super.visit(calc);
+ rels.add(visitedRel);
+ return visitedRel;
+ }
+ };
+ visitor.visit(calc);
+ assertThat(rels.size(), is(1));
Review comment:
Please add message that clarifies what is compared here, and why is 1
expected
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]