somandal commented on code in PR #10570:
URL: https://github.com/apache/pinot/pull/10570#discussion_r1160775752


##########
pinot-query-runtime/src/main/java/org/apache/pinot/query/runtime/plan/PhysicalPlanVisitor.java:
##########
@@ -61,12 +63,20 @@ public static OpChain build(StageNode node, 
PlanRequestContext context) {
 
   @Override
   public MultiStageOperator visitMailboxReceive(MailboxReceiveNode node, 
PlanRequestContext context) {
-    MailboxReceiveOperator mailboxReceiveOperator =
-        new MailboxReceiveOperator(context.getOpChainExecutionContext(), 
node.getExchangeType(),
-            node.getCollationKeys(), node.getCollationDirections(), 
node.isSortOnSender(), node.isSortOnReceiver(),
-            node.getDataSchema(), node.getSenderStageId(), node.getStageId());
-    context.addReceivingMailboxes(mailboxReceiveOperator.getSendingMailbox());
-    return mailboxReceiveOperator;
+    if (!CollectionUtils.isEmpty(node.getCollationKeys()) && 
node.isSortOnReceiver()) {

Review Comment:
   > [RR] hmm. could you explain more as: under what circumstances will this be 
true? did you mean there's an "ORDER BY " clause in the SQL, or there is 
actually a collation key specified on the SortExchange RelNode after Calcite 
has finish optimizer phase?
   
   I meant if there is a collation key specified in the SortExchange RelNode 
after the Calcite optimizer phase. I was just giving an example of ORDER BY 
queries
   
   > [RR] the above-described behavior is identical to prior to 
https://github.com/apache/pinot/pull/10408 yes? just instead of doing the 
sorting in SortExchange, previously we will create a SortNode on top of the 
Exchange Node?
   
   yes the end behavior is the exact same In terms of creation of the SortNode. 
Earlier the plan indicated sortOnReceiver as true for all LogicalSortExchange 
created for SortNodes without checking if collation key is set, but we handled 
skipping sorting in the receive operator. Now we explicitly set that 
sortOnReceiver is false (see planner test changes). Does that help clarify?



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to