klsince commented on code in PR #11978:
URL: https://github.com/apache/pinot/pull/11978#discussion_r1406646223


##########
pinot-broker/src/main/java/org/apache/pinot/broker/routing/BrokerRoutingManager.java:
##########
@@ -610,7 +611,16 @@ public RoutingTable getRoutingTable(BrokerRequest 
brokerRequest, long requestId)
       return null;
     }
     InstanceSelector.SelectionResult selectionResult = 
routingEntry.calculateRouting(brokerRequest, requestId);
-    Map<String, String> segmentToInstanceMap = 
selectionResult.getSegmentToInstanceMap();
+    Map<ServerInstance, List<String>> serverInstanceToSegmentsMap =
+        getServerInstanceToSegmentsMap(tableNameWithType, 
selectionResult.getSegmentToInstanceMap());
+    Map<ServerInstance, List<String>> serverInstanceToOptionalSegmentsMap =
+        getServerInstanceToSegmentsMap(tableNameWithType, 
selectionResult.getOptionalSegmentToInstanceMap());
+    return new RoutingTable(merge(serverInstanceToSegmentsMap, 
serverInstanceToOptionalSegmentsMap),
+        selectionResult.getUnavailableSegments(), 
selectionResult.getNumPrunedSegments());

Review Comment:
   To simplify this merging logic, I'll use empty list in Pair<List, List> even 
if there is no optional segments. But when creating the InstanceRequest, I'll 
set optionalSegment to null if it's empty, as I found there are places in 
multi-staged query that don't set this field when creating InstanceRequest. So 
leaving this field as null if it's empty is a bit more backward compatible, 
than setting it to an empty list.



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