shauryachats commented on code in PR #16204:
URL: https://github.com/apache/pinot/pull/16204#discussion_r2167816421


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/v2/opt/rules/LiteModeWorkerAssignmentRule.java:
##########
@@ -128,6 +129,49 @@ static String stripIdPrefixFromWorker(String worker) {
     return worker.split("@")[1];
   }
 
+  /**
+   * Infers Exchange to be added on top of the leaf stage.
+   */
+  private PhysicalExchange inferPDDForLeafExchange(PRelNode leafStageRoot, 
List<String> liteModeWorkers) {
+    RelCollation collation = 
leafStageRoot.unwrap().getTraitSet().getCollation();
+    PinotDataDistribution pdd;
+    if (collation != null && !collation.getFieldCollations().isEmpty()) {
+      // If the leaf stage root has a collation trait, then we will use a 
sorted receive in the exchange, so we can
+      // add the collation to the PDD.
+      pdd = new PinotDataDistribution(
+          RelDistribution.Type.SINGLETON, liteModeWorkers, 
liteModeWorkers.hashCode(), null, collation);
+    } else {
+      pdd = new PinotDataDistribution(
+          RelDistribution.Type.SINGLETON, liteModeWorkers, 
liteModeWorkers.hashCode(), null, null);

Review Comment:
   nit: Could we not move the `!collection.getFieldCollations().isEmpty()` 
check within `PinotDataDistribution` so that this is not repeated in the future?



##########
pinot-query-planner/src/main/java/org/apache/pinot/query/planner/physical/v2/opt/rules/LiteModeWorkerAssignmentRule.java:
##########
@@ -128,6 +129,49 @@ static String stripIdPrefixFromWorker(String worker) {
     return worker.split("@")[1];
   }
 
+  /**
+   * Infers Exchange to be added on top of the leaf stage.
+   */
+  private PhysicalExchange inferPDDForLeafExchange(PRelNode leafStageRoot, 
List<String> liteModeWorkers) {
+    RelCollation collation = 
leafStageRoot.unwrap().getTraitSet().getCollation();
+    PinotDataDistribution pdd;
+    if (collation != null && !collation.getFieldCollations().isEmpty()) {
+      // If the leaf stage root has a collation trait, then we will use a 
sorted receive in the exchange, so we can
+      // add the collation to the PDD.
+      pdd = new PinotDataDistribution(
+          RelDistribution.Type.SINGLETON, liteModeWorkers, 
liteModeWorkers.hashCode(), null, collation);
+    } else {
+      pdd = new PinotDataDistribution(
+          RelDistribution.Type.SINGLETON, liteModeWorkers, 
liteModeWorkers.hashCode(), null, null);

Review Comment:
   nit: Could we move the `!collection.getFieldCollations().isEmpty()` check 
within `PinotDataDistribution` so that this is not repeated in the future?



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