siddharthteotia commented on code in PR #8558: URL: https://github.com/apache/pinot/pull/8558#discussion_r855395674
########## pinot-query-planner/src/main/java/org/apache/pinot/query/planner/StagePlanner.java: ########## @@ -95,12 +97,15 @@ private StageNode walkRelPlan(RelNode node, int currentStageId) { if (isExchangeNode(node)) { // 1. exchangeNode always have only one input, get its input converted as a new stage root. StageNode nextStageRoot = walkRelPlan(node.getInput(0), getNewStageId()); - RelDistribution.Type exchangeType = ((LogicalExchange) node).distribution.getType(); + RelDistribution distribution = ((LogicalExchange) node).getDistribution(); + RelDistribution.Type exchangeType = distribution.getType(); // 2. make an exchange sender and receiver node pair - StageNode mailboxReceiver = new MailboxReceiveNode(currentStageId, nextStageRoot.getStageId(), exchangeType); - StageNode mailboxSender = new MailboxSendNode(nextStageRoot.getStageId(), mailboxReceiver.getStageId(), + StageNode mailboxReceiver = new MailboxReceiveNode(currentStageId, node.getRowType(), nextStageRoot.getStageId(), exchangeType); + StageNode mailboxSender = new MailboxSendNode(nextStageRoot.getStageId(), node.getRowType(), + mailboxReceiver.getStageId(), exchangeType, exchangeType == RelDistribution.Type.HASH_DISTRIBUTED + ? new FieldSelectionKeySelector(distribution.getKeys().get(0)) : null); Review Comment: yes totally agree on making this decision dictated by statistics / optimizer etc. My point was more on if we are hardcoding the exchange type in the initial implementation, it can be broadcast as I feel it is simpler to debug / get right initially may be -- 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