Jackie-Jiang commented on code in PR #11912:
URL: https://github.com/apache/pinot/pull/11912#discussion_r1378020470


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/logical/PlanFragmenter.java:
##########
@@ -126,49 +124,65 @@ public PlanNode visitExchange(ExchangeNode node, Context 
context) {
     if (!isPlanFragmentSplitter(node)) {
       return process(node, context);
     }
-    int currentPlanFragmentId = context._previousPlanFragmentId;
-    int nextPlanFragmentId = ++context._currentPlanFragmentId;
-    // Set previous PlanFragment ID in the context to be the next PlanFragment 
ID to be used by the child node.
-    context._previousPlanFragmentId = nextPlanFragmentId;
-    PlanNode nextPlanFragmentRoot = node.getInputs().get(0).visit(this, 
context);
 
+    // Split the ExchangeNode to a MailboxReceiveNode and a MailboxSendNode, 
where MailboxReceiveNode is the leave node
+    // of the current PlanFragment, and MailboxSendNode is the root node of 
the next PlanFragment.
+    int receiverPlanFragmentId = context._currentPlanFragmentId;
+    int senderPlanFragmentId = context._nextPlanFragmentId.getAndIncrement();

Review Comment:
   Modified to `MutableInt` to avoid confusion.
   IMO this is the correct way to handle this recursion. Basically we share 
`_nextPlanFragmentId` across all PlanFragments to ensure uniqueness of 
PlanFragment ID. Added a comment to explain this



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