gortiz commented on code in PR #19558:
URL: https://github.com/apache/pinot/pull/19558#discussion_r4015819366


##########
pinot-query-planner/src/main/java/org/apache/pinot/query/routing/WorkerManager.java:
##########
@@ -1785,8 +1789,10 @@ private PartitionTableInfo 
calculatePartitionTableInfo(String tableName) {
       String realtimeTableName = 
TableNameBuilder.REALTIME.tableNameWithType(tableName);
       boolean offlineRoutingExists = 
_routingManager.routingExists(offlineTableName);
       boolean realtimeRoutingExists = 
_routingManager.routingExists(realtimeTableName);
-      Preconditions.checkState(offlineRoutingExists || realtimeRoutingExists, 
"Routing doesn't exist for table: %s",
-          tableName);
+      if (!offlineRoutingExists && !realtimeRoutingExists) {

Review Comment:
   Following up on my comment above — I built the case and it's worse than I 
described. It isn't only a worse error code on a query that was failing anyway: 
with `inferPartitionHint` enabled, **a healthy logical table stops compiling**.
   
   A logical table never has a routing entry — `_routingEntryMap` is populated 
only by `buildRouting(tableNameWithType)` for physical tables 
(`BaseBrokerRoutingManager:957`), while `buildRoutingForLogicalTable` installs 
only time-boundary managers (`:628-650`). It is routed at plan time by 
`LogicalTableRouteProvider` from `DispatchablePlanVisitor#visitTableScan`, 
which never consults `routingExists`. So `routingExists` is false for both 
typed names of a table that is entirely fine, and the implicit-hint rule 
reaches this check during `compile()`.
   
   A/B on the PR parent vs. this branch, same test, only the commit differs:
   
   ```
                                        8228534299 (parent)      ac8f9a88 (PR)
   SET inferPartitionHint=true;         compile OK               compile -> 
QUERY_PLANNING
     SELECT col1 FROM logicalTable      planQuery OK             "Routing 
doesn't exist for
                                                                  table: 
logicalTable"
   
   same query, no hint option           compile OK               compile OK
                                        planQuery OK             planQuery OK
   ```
   
   The second row is the control. This makes fix (1) — catching 
`QueryException` in `inferTableOptions` — mandatory rather than defensive, and 
the extra test is best written on the logical-table case, since that is the one 
where a query that works today starts failing.
   



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