You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2021/04/05 07:52:49 UTC

[GitHub] [calcite] xy2953396112 commented on a change in pull request #2252: [CALCITE-4386] Support RelShuttle visit LogicalCalc

xy2953396112 commented on a change in pull request #2252:
URL: https://github.com/apache/calcite/pull/2252#discussion_r606969187



##########
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);

Review comment:
       ok




-- 
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:
users@infra.apache.org