walterddr commented on code in PR #8558:
URL: https://github.com/apache/pinot/pull/8558#discussion_r855479255


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/rules/PinotExchangeNodeInsertRule.java:
##########
@@ -57,12 +60,21 @@ public boolean matches(RelOptRuleCall call) {
 
   @Override
   public void onMatch(RelOptRuleCall call) {
+    // TODO: this only works for single equality JOIN. add generic condition 
parser
     Join join = call.rel(0);
     RelNode leftInput = join.getInput(0);
     RelNode rightInput = join.getInput(1);
 
-    RelNode leftExchange = LogicalExchange.create(leftInput, 
RelDistributions.SINGLETON);
-    RelNode rightExchange = LogicalExchange.create(rightInput, 
RelDistributions.BROADCAST_DISTRIBUTED);
+    // TODO: this currently has a hard-coded exchange type. add exchange 
selection option
+//    RelNode lExchange = LogicalExchange.create(leftInput, 
RelDistributions.SINGLETON);
+//    RelNode rExchange = LogicalExchange.create(rightInput, 
RelDistributions.BROADCAST_DISTRIBUTED);
+    int leftOperandIndex = ((RexInputRef) ((RexCall) 
join.getCondition()).getOperands().get(0)).getIndex();
+    int rightOperandIndex = ((RexInputRef) ((RexCall) 
join.getCondition()).getOperands().get(1)).getIndex()
+        - join.getLeft().getRowType().getFieldNames().size();
+    RelNode leftExchange = LogicalExchange.create(leftInput,
+        RelDistributions.hash(Collections.singletonList(leftOperandIndex)));
+    RelNode rightExchange = LogicalExchange.create(rightInput,
+        RelDistributions.hash(Collections.singletonList(rightOperandIndex)));

Review Comment:
   add a placeholder to use SqlHint to determine whether to use broadcast or 
hash distribution



-- 
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-unsubscr...@pinot.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@pinot.apache.org
For additional commands, e-mail: commits-h...@pinot.apache.org

Reply via email to