jamesstarr commented on a change in pull request #2385:
URL: https://github.com/apache/calcite/pull/2385#discussion_r656488841



##########
File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
##########
@@ -2422,18 +2422,16 @@ public RelBuilder join(JoinRelType joinType, RexNode 
condition,
     }
     if (correlate) {
       final CorrelationId id = Iterables.getOnlyElement(variablesSet);
-      if (!RelOptUtil.notContainsCorrelation(left.rel, id, Litmus.IGNORE)) {
-        throw new IllegalArgumentException("variable " + id
-            + " must not be used by left input to correlation");
-      }
       // Correlate does not have an ON clause.
       switch (joinType) {
       case LEFT:
       case SEMI:
       case ANTI:
         // For a LEFT/SEMI/ANTI, predicate must be evaluated first.
         stack.push(right);
-        filter(condition.accept(new Shifter(left.rel, id, right.rel)));
+        filter(
+            RelOptUtil.correlateLeftShiftRight(getRexBuilder(),
+                left.rel, id, right.rel, condition));

Review comment:
       @zabetak, I removed the check right side for considering if the join is 
correlated, would this pr be acceptatable?




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