Jackie-Jiang commented on code in PR #11393:
URL: https://github.com/apache/pinot/pull/11393#discussion_r1299419337
##########
pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java:
##########
@@ -265,14 +265,42 @@ private void
assignWorkersToIntermediateFragment(PlanFragment fragment, Dispatch
// TODO: actually make assignment strategy decisions for intermediate
stages
List<ServerInstance> serverInstances;
Set<String> tableNames = context.getTableNames();
+ Map<String, ServerInstance> enabledServerInstanceMap =
_routingManager.getEnabledServerInstanceMap();
if (tableNames.size() == 0) {
// TODO: Short circuit it when no table needs to be scanned
// This could be the case from queries that don't actually fetch values
from the tables. In such cases the
// routing need not be tenant aware.
// Eg: SELECT 1 AS one FROM select_having_expression_test_test_having
HAVING 1 > 2;
- serverInstances = new
ArrayList<>(_routingManager.getEnabledServerInstanceMap().values());
+ serverInstances = new ArrayList<>(enabledServerInstanceMap.values());
} else {
- serverInstances = fetchServersForIntermediateStage(tableNames);
+ Set<String> servers = new HashSet<>();
+ for (String tableName : tableNames) {
+ TableType tableType =
TableNameBuilder.getTableTypeFromTableName(tableName);
+ if (tableType == null) {
+ Set<String> offlineTableServers =
_routingManager.getServingInstances(
+
TableNameBuilder.forType(TableType.OFFLINE).tableNameWithType(tableName));
+ if (offlineTableServers != null) {
+ servers.addAll(offlineTableServers);
+ }
+ Set<String> realtimeTableServers =
_routingManager.getServingInstances(
+
TableNameBuilder.forType(TableType.REALTIME).tableNameWithType(tableName));
+ if (realtimeTableServers != null) {
+ servers.addAll(realtimeTableServers);
+ }
+ } else {
+ Set<String> tableServers =
_routingManager.getServingInstances(tableName);
+ if (tableServers != null) {
+ servers.addAll(tableServers);
+ }
+ }
+ }
+ serverInstances = new ArrayList<>(servers.size());
Review Comment:
Correct, but this should give a very good estimation. It doesn't need to be
exact
--
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]