walterddr commented on code in PR #10336:
URL: https://github.com/apache/pinot/pull/10336#discussion_r1131946143
##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java:
##########
@@ -170,10 +171,19 @@ private String getMultiStageQueryResponse(String query,
String queryOptions, Htt
return QueryException.ACCESS_DENIED_ERROR.toString();
}
- // Get brokers, only DEFAULT tenant is supported for now.
- // TODO: implement logic that only allows executing query where all
accessed tables are within the same tenant.
- List<String> instanceIds = new
ArrayList<>(_pinotHelixResourceManager.getAllInstancesForBrokerTenant(
- TagNameUtils.DEFAULT_TENANT_NAME));
+ SqlNodeAndOptions sqlNodeAndOptions = RequestUtils.parseQuery(query);
+ List<String> tableNames =
CalciteSqlParser.extractTableNamesFromNode(sqlNodeAndOptions.getSqlNode());
+ if (tableNames.size() == 0) {
+ return QueryException.SQL_PARSING_ERROR.toString();
+ }
+
+ String brokerTenant = getCommonBrokerTenant(tableNames);
+ String serverTenant = getCommonServerTenant(tableNames);
+ if (brokerTenant == null || serverTenant == null) {
+ return QueryException.TABLES_NOT_ON_SAME_TENANT_ERROR.toString();
Review Comment:
```suggestion
if (brokerTenant == null || serverTenant == null) {
return QueryException.getException(QueryException.SQL_PARSING_ERROR,
new Exception("Unable to dispatch multistage query with multiple tables on
different tenant")).toString();
```
--
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]