Details
-
Bug
-
Status: Closed
-
Major
-
Resolution: Fixed
-
1.30.0
Description
Method RelNode#accept(RelShuttle) is not overridden for LogicalCalc and LogicalTableModify. This leads to the bug when logic implemented in RelShuttle#visit(LogicalCalc) is never applied because visit() method is never called due to incorrect dispatching.
This test will fail without accept(RelShuttle) method is overridden in Calc:
@Test void testRelShuttleForLogicalCalc() { final String sql = "select ename from emp"; final RelNode rel = sql(sql).toRel(); 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; } }; calc.accept(visitor); assertThat(rels.size(), is(1)); assertThat(rels.get(0), isA(LogicalCalc.class)); }
Attachments
Issue Links
- is caused by
-
CALCITE-3607 Support LogicalTableModify in RelShuttle
- Closed
-
CALCITE-3938 Support LogicalCalc in RelShuttle
- Closed
- links to