xiangfu0 commented on code in PR #12537:
URL: https://github.com/apache/pinot/pull/12537#discussion_r1509943974


##########
pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java:
##########
@@ -243,10 +246,17 @@ private String getQueryResponse(String query, @Nullable 
SqlNode sqlNode, String
     // Get resource table name.
     String tableName;
     try {
-      String inputTableName =
-          sqlNode != null ? 
RequestUtils.getTableNames(CalciteSqlParser.compileSqlNodeToPinotQuery(sqlNode)).iterator()
-              .next() : 
CalciteSqlCompiler.compileToBrokerRequest(query).getQuerySource().getTableName();
-      tableName = 
_pinotHelixResourceManager.getActualTableName(inputTableName);
+      if (sqlNode != null) {
+        PinotQuery pinotQuery = 
CalciteSqlParser.compileSqlNodeToPinotQuery(sqlNode);
+        if (pinotQuery.isShowTables()) {
+          return showTablesResponse();
+        }
+        String inputTableName = 
RequestUtils.getTableNames(pinotQuery).iterator().next();
+        tableName = 
_pinotHelixResourceManager.getActualTableName(inputTableName);

Review Comment:
   this is for pinot controller only, what if the query is sent to pinot broker?
   I feel you can call getTables API for response then wrap it as query 
response.



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