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/05/27 15:55:19 UTC

[GitHub] [calcite] zabetak commented on a change in pull request #2419: [CALCITE-4624] When query contains complex function, materialized vie…

zabetak commented on a change in pull request #2419:
URL: https://github.com/apache/calcite/pull/2419#discussion_r640758228



##########
File path: core/src/main/java/org/apache/calcite/plan/SubstitutionVisitor.java
##########
@@ -1755,6 +1758,20 @@ private static boolean sameRelCollectionNoOrderConsidered(
     return true;
   }
 
+  private static @Nullable List<RexNode> compenProjs(List<RexNode> queryRexNodes,
+      List<RexNode> targetRexNodes) {
+    List<RexNode> compenProjs = new ArrayList<>();
+    for (int i = 0; i < queryRexNodes.size(); i++) {
+      RexNode rexNode = queryRexNodes.get(i);
+      int index = targetRexNodes.indexOf(rexNode);
+      if (index < 0) {
+        return null;
+      }
+      compenProjs.add(new RexInputRef(index, rexNode.getType()));
+    }
+    return compenProjs;
+  }
+

Review comment:
       I had the impression that it was the responsibility of the compensation shuttle (`getRexShuttle`) to do this work. Why is it necessary to have a separate method?




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