walterddr commented on code in PR #10336: URL: https://github.com/apache/pinot/pull/10336#discussion_r1119423880
########## 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: yeah that's probably b/c the broker you hit is responsible for only a set of tenants and that set of tenants are responsible for all the tables in the query. nevertheless it is not meant to be fully bug-free just b/c it can run. I can think of several scenarios that this could go wrong in other cluster settings. Let's aim at a single tenant and add tests for different type of configuration of 1. broker tenant 2. server tenant (same, subset, superset of broker) 3. table (identical to broker, identical to server but subset of broker, identical to broker, subset of server) and mix and match multiple tables with the above configuration -- 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