[ 
https://issues.apache.org/jira/browse/CALCITE-6961?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Yu Xu updated CALCITE-6961:
---------------------------
    Description: 
follow https://issues.apache.org/jira/browse/CALCITE-6959 

Currently RelShuttle also do not support LogicalRepeatUnion (I also had check 
for other Logical Type, seems remain LogicalRepeatUnion need to support) :
 # *LogicalRepeatUnion* *is not overridden for accept(RelShuttle shuttle) ;*

 # *RelShuttle#visit not support for* *LogicalRepeatUnion* *;*

so follow test would not work:
{code:java}
@Test void testRelShuttleForLogicalRepeatUnion() {
  final String sql = "WITH RECURSIVE delta(n) AS (\n"
      + "VALUES (1)\n"
      + "UNION ALL\n"
      + "SELECT n+1 FROM delta WHERE n < 10\n"
      + ")\n"
      + "SELECT * FROM delta";
  final RelNode rel = sql(sql).toRel();
  final List<RelNode> rels = new ArrayList<>();
  final RelShuttleImpl visitor = new RelShuttleImpl() {
    @Override public RelNode visit(LogicalRepeatUnion repeatUnion) {
      RelNode visitedRel = super.visit(repeatUnion);
      rels.add(visitedRel);
      return visitedRel;
    }
  };
  rel.accept(visitor);
  assertThat(rels, hasSize(1));
  assertThat(rels.get(0), instanceOf(LogicalRepeatUnion.class));
} {code}
others in Logic seams OK for it, need a pr to fix it.

  was:
follow https://issues.apache.org/jira/browse/CALCITE-6959 

Currently RelShuttle also do not support LogicalRepeatUnion :
 # 
*LogicalRepeatUnion* *is not overridden for accept(RelShuttle shuttle) ;*
 # *RelShuttle#visit not support for* *LogicalRepeatUnion* *;*

so follow test would not work:
{code:java}
@Test void testRelShuttleForLogicalRepeatUnion() {
  final String sql = "WITH RECURSIVE delta(n) AS (\n"
      + "VALUES (1)\n"
      + "UNION ALL\n"
      + "SELECT n+1 FROM delta WHERE n < 10\n"
      + ")\n"
      + "SELECT * FROM delta";
  final RelNode rel = sql(sql).toRel();
  final List<RelNode> rels = new ArrayList<>();
  final RelShuttleImpl visitor = new RelShuttleImpl() {
    @Override public RelNode visit(LogicalRepeatUnion repeatUnion) {
      RelNode visitedRel = super.visit(repeatUnion);
      rels.add(visitedRel);
      return visitedRel;
    }
  };
  rel.accept(visitor);
  assertThat(rels, hasSize(1));
  assertThat(rels.get(0), instanceOf(LogicalRepeatUnion.class));
} {code}
others in Logic seams OK for it, need a pr to fix it.


> Support LogicalRepeatUnion in RelShuttle
> ----------------------------------------
>
>                 Key: CALCITE-6961
>                 URL: https://issues.apache.org/jira/browse/CALCITE-6961
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.39.0
>            Reporter: Yu Xu
>            Assignee: Yu Xu
>            Priority: Major
>              Labels: pull-request-available
>             Fix For: 1.40.0
>
>
> follow https://issues.apache.org/jira/browse/CALCITE-6959 
> Currently RelShuttle also do not support LogicalRepeatUnion (I also had check 
> for other Logical Type, seems remain LogicalRepeatUnion need to support) :
>  # *LogicalRepeatUnion* *is not overridden for accept(RelShuttle shuttle) ;*
>  # *RelShuttle#visit not support for* *LogicalRepeatUnion* *;*
> so follow test would not work:
> {code:java}
> @Test void testRelShuttleForLogicalRepeatUnion() {
>   final String sql = "WITH RECURSIVE delta(n) AS (\n"
>       + "VALUES (1)\n"
>       + "UNION ALL\n"
>       + "SELECT n+1 FROM delta WHERE n < 10\n"
>       + ")\n"
>       + "SELECT * FROM delta";
>   final RelNode rel = sql(sql).toRel();
>   final List<RelNode> rels = new ArrayList<>();
>   final RelShuttleImpl visitor = new RelShuttleImpl() {
>     @Override public RelNode visit(LogicalRepeatUnion repeatUnion) {
>       RelNode visitedRel = super.visit(repeatUnion);
>       rels.add(visitedRel);
>       return visitedRel;
>     }
>   };
>   rel.accept(visitor);
>   assertThat(rels, hasSize(1));
>   assertThat(rels.get(0), instanceOf(LogicalRepeatUnion.class));
> } {code}
> others in Logic seams OK for it, need a pr to fix it.



--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to