hbtoo commented on a change in pull request #1949:
URL: https://github.com/apache/calcite/pull/1949#discussion_r416272986



##########
File path: 
core/src/main/java/org/apache/calcite/plan/volcano/VolcanoPlanner.java
##########
@@ -940,11 +941,24 @@ void reregister(
       assert equivRel.getClass() == rel.getClass();
       assert equivRel.getTraitSet().equals(rel.getTraitSet());
 
+      mergeIdenticalRels(equivRel, rel);
       return;
     }
 
     // Add the relational expression into the correct set and subset.
-    addRelToSet(rel, set);
+    if (!prunedNodes.contains(rel)) {
+      addRelToSet(rel, set);
+    }
+  }
+
+  /**
+   * Update relNode related information when two identical relNodes are
+   * de-duped.
+   */
+  private void mergeIdenticalRels(RelNode to, RelNode from) {

Review comment:
       I changed it to RelNode rel, RelNode duplicate, where duplicate is the 
one that's about to be discarded. 




----------------------------------------------------------------
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]


Reply via email to