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

morrysnow pushed a commit to branch branch-2.1
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/branch-2.1 by this push:
     new f24d55fc947 [fix](syntax) multi statements must delim with semicolon 
(#38670) (#38753)
f24d55fc947 is described below

commit f24d55fc9470f86ae6ca875b5c4488b5233a6f45
Author: morrySnow <101034200+morrys...@users.noreply.github.com>
AuthorDate: Fri Aug 2 14:49:51 2024 +0800

    [fix](syntax) multi statements must delim with semicolon (#38670) (#38753)
    
    pick from master #38670
---
 .../src/main/antlr4/org/apache/doris/nereids/DorisParser.g4      | 2 +-
 .../java/org/apache/doris/nereids/parser/NereidsParserTest.java  | 9 ++++++++-
 regression-test/suites/insert_p0/insert.groovy                   | 2 +-
 3 files changed, 10 insertions(+), 3 deletions(-)

diff --git a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4 
b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
index 35db2510c11..7b56e1479c4 100644
--- a/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
+++ b/fe/fe-core/src/main/antlr4/org/apache/doris/nereids/DorisParser.g4
@@ -26,7 +26,7 @@ options { tokenVocab = DorisLexer; }
 }
 
 multiStatements
-    : (statement SEMICOLON*)+ EOF
+    : statement (SEMICOLON+ statement)* SEMICOLON* EOF
     ;
 
 singleStatement
diff --git 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
index 5773a9f29b5..2bbcbc4290d 100644
--- 
a/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
+++ 
b/fe/fe-core/src/test/java/org/apache/doris/nereids/parser/NereidsParserTest.java
@@ -54,11 +54,18 @@ public class NereidsParserTest extends ParserTestBase {
     @Test
     public void testParseMultiple() {
         NereidsParser nereidsParser = new NereidsParser();
-        String sql = "SELECT b FROM test;SELECT a FROM test;";
+        String sql = "SELECT b FROM test;;;;SELECT a FROM test;";
         List<Pair<LogicalPlan, StatementContext>> logicalPlanList = 
nereidsParser.parseMultiple(sql);
         Assertions.assertEquals(2, logicalPlanList.size());
     }
 
+    @Test
+    public void testParseMultipleError() {
+        NereidsParser nereidsParser = new NereidsParser();
+        String sql = "SELECT b FROM test SELECT a FROM test;";
+        Assertions.assertThrowsExactly(ParseException.class, () -> 
nereidsParser.parseMultiple(sql));
+    }
+
     @Test
     public void testSingle() {
         NereidsParser nereidsParser = new NereidsParser();
diff --git a/regression-test/suites/insert_p0/insert.groovy 
b/regression-test/suites/insert_p0/insert.groovy
index 4d1eae21962..bcab9956c1d 100644
--- a/regression-test/suites/insert_p0/insert.groovy
+++ b/regression-test/suites/insert_p0/insert.groovy
@@ -102,7 +102,7 @@ suite("insert") {
           partition p2 values[('50'), ('100'))
         )
         distributed by hash(id) buckets 100
-        properties('replication_num'='1')
+        properties('replication_num'='1');
         
         insert into table_test_insert1 values(1), (50);
         


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org
For additional commands, e-mail: commits-h...@doris.apache.org

Reply via email to