xiangfu0 commented on code in PR #19537:
URL: https://github.com/apache/pinot/pull/19537#discussion_r4221908577


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java:
##########
@@ -2075,4 +2108,35 @@ private static Map<String, List<String>> 
getSegmentsMap(@Nullable List<String> o
       return Map.of(TableType.REALTIME.name(), realtimeSegments);
     }
   }
+
+  private void 
assignWorkersForNonPartitionedLeafSegmentsWhenNoServersHaveSegments(DispatchablePlanMetadata
 metadata,
+      String tableName, Map<String, RoutingTable> routingTableMap, 
DispatchablePlanContext context,
+      @Nullable TimeBoundaryInfo timeBoundaryInfo) {
+    Set<String> serversRoutingToTable = 
_routingManager.getServingInstances(tableName);

Review Comment:
   **Empty-table queries can now fail instead of returning empty results.** 
`getServingInstances()` is keyed by `tableNameWithType` in 
`BaseBrokerRoutingManager` (`_routingEntryMap.get(tableNameWithType)`), but 
`tableName` here is `metadata.getScannedTables().get(0)`, which is commonly the 
raw table name. For `SELECT * FROM emptyTable` on a table whose servers hold no 
online segments, this returns `null` and the query throws 
`IllegalStateException("No routable server for empty routing on table")` — 
before this PR the same query short-circuited to an empty result. The new test 
passes only because `CapturingRoutingManager.getServingInstances` ignores the 
table name. The typed names are available as `routingTableMap` keys 
(`TableNameBuilder.forType(type).tableNameWithType(rawName)`).



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