jh3507 commented on a change in pull request #1334: [CALCITE-3111] Allow custom 
implementations of Correlate in RelDecorr…
URL: https://github.com/apache/calcite/pull/1334#discussion_r314029516
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/tools/RelBuilder.java
 ##########
 @@ -1978,6 +1978,21 @@ public RelBuilder join(JoinRelType joinType, RexNode 
condition,
     return this;
   }
 
+  /** Creates a {@link org.apache.calcite.rel.core.Correlate}
+   * with correlateId and requiredColumns. */
+  public RelBuilder correlate(JoinRelType joinType,
+      CorrelationId correlationId, ImmutableBitSet requiredColumns) {
+    Frame right = stack.pop();
+    final Frame left = stack.pop();
+    final RelNode join = correlateFactory
+        .createCorrelate(left.rel, right.rel, correlationId, requiredColumns, 
joinType);
+    final ImmutableList.Builder<Field> fields = ImmutableList.builder();
+    fields.addAll(left.fields);
+    fields.addAll(right.fields);
+    stack.push(new Frame(join, fields.build()));
+    return this;
+  }
+
 
 Review comment:
   Thanks for the suggestion. I updated signature. So, in correlate case, I 
think we should create an extra project on right relation if given fields are 
not simply RexInputRefs. Added a new test case for that as well.

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


With regards,
Apache Git Services

Reply via email to