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/11/10 07:43:23 UTC

[GitHub] [calcite] jaystarshot commented on a change in pull request #2370: [CALCITE-3366] RelDecorrelator supports Union (Xu Zhaohui & Jin Xing)

jaystarshot commented on a change in pull request #2370:
URL: https://github.com/apache/calcite/pull/2370#discussion_r746315733



##########
File path: core/src/main/java/org/apache/calcite/sql2rel/RelDecorrelator.java
##########
@@ -1272,6 +1274,138 @@ private static boolean isWidening(RelDataType type, RelDataType type1) {
     return register(rel, newJoin, mapOldToNewOutputs, corDefOutputs);
   }
 
+  public @Nullable Frame decorrelateRel(LogicalUnion rel, boolean isCorVarDefined) {
+    return decorrelateRel((Union) rel, isCorVarDefined);
+  }
+
+  public @Nullable Frame decorrelateRel(Union rel, boolean isCorVarDefined) {
+    assert !cm.mapRefRelToCorRef.containsKey(rel);
+
+    final List<RelNode> oldInputs = rel.getInputs();
+
+    final List<Frame> inputFrames = new ArrayList<>();
+    final Set<CorDef> corDefSet = new HashSet<>();
+
+    // Decorrelate to collect input frames and collect all
+    // the corDefOutputs from the frames. Note that the
+    // corDefOutputs might be different among the frames.
+    for (RelNode oldInput: oldInputs) {
+      final Frame frame = getInvoke(oldInput, isCorVarDefined, rel);
+      if (frame == null) {

Review comment:
       What if one part  of the union is changed due to de-correlation and other part is not changed ? why do we return null here even if one part of the union has changed? 
   Eg - one side has Value Rel (hence returns null) , other has Correlate-...-TableScan




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

To unsubscribe, e-mail: commits-unsubscribe@calcite.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org