tibrewalpratik17 commented on code in PR #10336: URL: https://github.com/apache/pinot/pull/10336#discussion_r1119352663
########## 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: > Thus my suggestion is should we let's limit the scope to "all tables belong to the same tenant, not necessarily 'default'" first? This PR takes care of this scenario specifically. At present, queries work fine when we hit brokers directly of a non-default tenant as @ankitsultana mentioned. We want to allow those queries to be pushed down to broker from controller as well. -- 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