tibrewalpratik17 commented on code in PR #10336: URL: https://github.com/apache/pinot/pull/10336#discussion_r1120430373
########## pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java: ########## @@ -170,10 +171,10 @@ 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()); + + List<String> instanceIds = getCommonInstances(tableNames); Review Comment: I think the issue here is that we are finding common instances for tables and in case of multiple tenants sharing few instances, this can lead to cross-tenant queries. Will use brokerTenant from tableConfig and see if all the tables are under the same tenant. -- 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