walterddr commented on code in PR #10955:
URL: https://github.com/apache/pinot/pull/10955#discussion_r1237853380


##########
pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java:
##########
@@ -190,8 +192,10 @@ public Future<ResultSetGroup> executeAsync(@Nullable 
String tableName, String qu
   private static String[] resolveTableName(String query) {
     try {
       SqlNodeAndOptions sqlNodeAndOptions = 
CalciteSqlParser.compileToSqlNodeAndOptions(query);
-      List<String> tableNames = 
CalciteSqlParser.extractTableNamesFromNode(sqlNodeAndOptions.getSqlNode());
-      return tableNames.toArray(new String[0]);
+      String tableName = (sqlNodeAndOptions.getSqlNode() != null
+          ? 
RequestUtils.getTableName(CalciteSqlParser.compileSqlNodeToPinotQuery(sqlNodeAndOptions.getSqlNode()))
+          : 
CalciteSqlCompiler.compileToBrokerRequest(query).getQuerySource().getTableName());
+      return new String[]{tableName};
     } catch (Exception e) {
       LOGGER.error("Cannot parse table name from query: {}", query, e);

Review Comment:
   nit we can add additional comments
   ```suggestion
         LOGGER.error("Cannot parse table name from query: {}. Fallback to 
broker selector default.", query, e);
   ```



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