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

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

commit 69813a8c40f1406a1491f4dfb16b6173af4e3ce3
Author: Steve Carlin <[email protected]>
AuthorDate: Thu Sep 25 12:10:55 2025 -0700

    IMPALA-14464: Calcite planner should allow semi-colon in statement
    
    The Calcite planner now handles a sql statement that has a semi-colon
    at the end. Note that impala-shell doesn't pass the semi-colon into
    the server. This is only seen with a direct call to the server.
    
    Change-Id: Ie690159cd03f28f6b793628aa946292af71b6970
    Reviewed-on: http://gerrit.cloudera.org:8080/23517
    Reviewed-by: Joe McDonnell <[email protected]>
    Tested-by: Impala Public Jenkins <[email protected]>
---
 java/calcite-planner/src/main/codegen/templates/Parser.jj | 4 ++--
 tests/custom_cluster/test_calcite_planner.py              | 6 ++++++
 2 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/java/calcite-planner/src/main/codegen/templates/Parser.jj 
b/java/calcite-planner/src/main/codegen/templates/Parser.jj
index 0b342e16b..65bd97a7e 100644
--- a/java/calcite-planner/src/main/codegen/templates/Parser.jj
+++ b/java/calcite-planner/src/main/codegen/templates/Parser.jj
@@ -1138,9 +1138,9 @@ SqlNode SqlStmt() :
 }
 {
     (
-        stmt = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY)
+        stmt = OrderedQueryOrExpr(ExprContext.ACCEPT_QUERY) (<SEMICOLON>)*
     |
-        stmt = SqlExplain()
+        stmt = SqlExplain() (<SEMICOLON>)*
     )
     {
         return stmt;
diff --git a/tests/custom_cluster/test_calcite_planner.py 
b/tests/custom_cluster/test_calcite_planner.py
index 97b2ead67..30d12ac9c 100644
--- a/tests/custom_cluster/test_calcite_planner.py
+++ b/tests/custom_cluster/test_calcite_planner.py
@@ -41,3 +41,9 @@ class TestCalcitePlanner(CustomClusterTestSuite):
   def test_calcite_frontend(self, vector, unique_database):
     """Calcite planner does not work in local catalog mode yet."""
     self.run_test_case('QueryTest/calcite', vector, use_db=unique_database)
+
+  @pytest.mark.execute_serially
+  
@CustomClusterTestSuite.with_args(start_args="--env_vars=USE_CALCITE_PLANNER=true")
+  def test_semicolon(self, cursor):
+    cursor.execute("set use_calcite_planner=true;")
+    cursor.execute("select 4;")

Reply via email to