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

 ##########
 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:
   To be consistent with other methods in `RelBuilder` I don't think 
`requiredColumns` would be an `ImmutableBitSet`. It would be something a bit 
friendlier. Write some tests in RelBuilderTest and see which API is most 
user-friendly.

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