yashmayya opened a new pull request, #13235:
URL: https://github.com/apache/pinot/pull/13235

   - Fixes https://github.com/apache/pinot/issues/11990
   - If there are two tables - `a` (with broker tenant config `BrokerTenant1`) 
and `b` (with broker tenant config `BrokerTenant2`) and we run a query like 
`SELECT * FROM a JOIN b ON a.col1 = b.col1;` (through the controller's `POST 
/sql` API), this results in the ambiguous error message: 
`ProcessingException(errorCode:450, message:InternalError)`. Even the 
controller logs contain only the highly misleading error log: `Instance 
ProcessingException(errorCode:410, message:BrokerResourceMissingError) not 
found`.
   - This is because the case where no common broker instances (i.e., one with 
tenant tags for all tables involved in the query) are found 
[here](https://github.com/apache/pinot/blob/518fd180981ffa614042b8a5236650a2af41bfe5/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java#L239)
 isn't handled appropriately. The `instanceId` returned 
[here](https://github.com/apache/pinot/blob/518fd180981ffa614042b8a5236650a2af41bfe5/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java#L245)
 will be `ProcessingException(errorCode:410, 
message:BrokerResourceMissingError)` (from 
[here](https://github.com/apache/pinot/blob/518fd180981ffa614042b8a5236650a2af41bfe5/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java#L322)).
   - The controller then attempts to find a broker with instance ID here 
`ProcessingException(errorCode:410, message:BrokerResourceMissingError)` which 
obviously does not exist and results in the internal error being returned here 
- 
https://github.com/apache/pinot/blob/518fd180981ffa614042b8a5236650a2af41bfe5/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java#L354-L358
   - This patch fixes the issue by returning a clear error message when no 
common broker is found for a multi-stage query with tables from different 
tenants. For the above example query `SELECT * FROM a JOIN b ON a.col1 = 
b.col1;`, the returned error is now:
   ```
   ProcessingException(errorCode:410, message:BrokerResourceMissingError:
   java.lang.Exception: Unable to find a common broker instance for table 
tenants. Tables: [a, b], Tenants: [BrokerTenant2, BrokerTenant1]
        at 
org.apache.pinot.controller.api.resources.PinotQueryResource.getMultiStageQueryResponse(PinotQueryResource.java:244)
        at 
org.apache.pinot.controller.api.resources.PinotQueryResource.executeSqlQuery(PinotQueryResource.java:179)
        at 
org.apache.pinot.controller.api.resources.PinotQueryResource.handlePostSql(PinotQueryResource.java:127)
        at 
java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method))
   ```


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