Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[fix](syntax) multi statements must delim with semicolon #38670

Merged
merged 1 commit into from
Aug 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ options { tokenVocab = DorisLexer; }
}

multiStatements
: (statement SEMICOLON*)+ EOF
: statement (SEMICOLON+ statement)* SEMICOLON* EOF
;

singleStatement
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,11 +55,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();
Expand Down
2 changes: 1 addition & 1 deletion regression-test/suites/insert_p0/insert.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Loading