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/30 23:31:25 UTC

[pinot] branch master updated: Updated the code for showing the sql parsing exception. (#11009)

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 9821cee011 Updated the code for showing the sql parsing exception. (#11009)
9821cee011 is described below

commit 9821cee0115be999dea6d18389ad7411f8ad7c47
Author: Abhishek Sharma <ab...@spothero.com>
AuthorDate: Fri Jun 30 19:31:19 2023 -0400

    Updated the code for showing the sql parsing exception. (#11009)
---
 .../apache/pinot/controller/api/resources/PinotQueryResource.java   | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
index d77099250c..fe1a217d9c 100644
--- a/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
+++ b/pinot-controller/src/main/java/org/apache/pinot/controller/api/resources/PinotQueryResource.java
@@ -74,6 +74,7 @@ import org.apache.pinot.spi.utils.builder.TableNameBuilder;
 import org.apache.pinot.sql.parsers.CalciteSqlCompiler;
 import org.apache.pinot.sql.parsers.CalciteSqlParser;
 import org.apache.pinot.sql.parsers.PinotSqlType;
+import org.apache.pinot.sql.parsers.SqlCompilationException;
 import org.apache.pinot.sql.parsers.SqlNodeAndOptions;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
@@ -144,9 +145,8 @@ public class PinotQueryResource {
     SqlNodeAndOptions sqlNodeAndOptions;
     try {
       sqlNodeAndOptions = CalciteSqlParser.compileToSqlNodeAndOptions(sqlQuery);
-    } catch (Exception ex) {
-      String errorMessage = String.format("Unable to parse the SQL: '%s'", sqlQuery);
-      throw QueryException.getException(QueryException.SQL_PARSING_ERROR, new Exception(errorMessage));
+    } catch (SqlCompilationException ex) {
+      throw QueryException.getException(QueryException.SQL_PARSING_ERROR, ex);
     }
     Map<String, String> options = sqlNodeAndOptions.getOptions();
     if (queryOptions != null) {


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