You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@pinot.apache.org by ro...@apache.org on 2023/06/22 15:40:07 UTC

[pinot] branch master updated: Update pinot client to not use Calcite extractTableNames (#10955)

This is an automated email from the ASF dual-hosted git repository.

rongr pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/pinot.git


The following commit(s) were added to refs/heads/master by this push:
     new aea890a5ee Update pinot client to not use Calcite extractTableNames (#10955)
aea890a5ee is described below

commit aea890a5ee715bf06bf7dd1643a4e8ced3db67b9
Author: Pratik Tibrewal <ti...@uber.com>
AuthorDate: Thu Jun 22 21:10:00 2023 +0530

    Update pinot client to not use Calcite extractTableNames (#10955)
    
    * Update pinot client to not use Calcite extractTableNames
    * addressed comments
---
 .../src/main/java/org/apache/pinot/client/Connection.java         | 8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java
index 612754b1cd..6c15b674f8 100644
--- a/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java
+++ b/pinot-clients/pinot-java-client/src/main/java/org/apache/pinot/client/Connection.java
@@ -25,6 +25,7 @@ import java.util.concurrent.Future;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.TimeoutException;
 import javax.annotation.Nullable;
+import org.apache.pinot.common.utils.request.RequestUtils;
 import org.apache.pinot.sql.parsers.CalciteSqlParser;
 import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
 import org.slf4j.Logger;
@@ -190,10 +191,11 @@ public class Connection {
   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 =
+          RequestUtils.getTableName(CalciteSqlParser.compileSqlNodeToPinotQuery(sqlNodeAndOptions.getSqlNode()));
+      return new String[]{tableName};
     } catch (Exception e) {
-      LOGGER.error("Cannot parse table name from query: {}", query, e);
+      LOGGER.error("Cannot parse table name from query: {}. Fallback to broker selector default.", query, e);
     }
     return null;
   }


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@pinot.apache.org
For additional commands, e-mail: commits-help@pinot.apache.org