Skip to content

Commit 54682a7

Browse files
solontsevayman-sigma
authored andcommitted
Clickhouse: support empty parenthesized options (apache#1925)
1 parent e1f8cb2 commit 54682a7

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

src/parser/mod.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16285,9 +16285,9 @@ impl<'a> Parser<'a> {
1628516285

1628616286
fn parse_parenthesized_identifiers(&mut self) -> Result<Vec<Ident>, ParserError> {
1628716287
self.expect_token(&Token::LParen)?;
16288-
let partitions = self.parse_comma_separated(|p| p.parse_identifier())?;
16288+
let idents = self.parse_comma_separated0(|p| p.parse_identifier(), Token::RParen)?;
1628916289
self.expect_token(&Token::RParen)?;
16290-
Ok(partitions)
16290+
Ok(idents)
1629116291
}
1629216292

1629316293
fn parse_column_position(&mut self) -> Result<Option<MySQLColumnPosition>, ParserError> {

tests/sqlparser_clickhouse.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,10 @@ fn parse_create_table() {
224224
clickhouse().verified_stmt(
225225
r#"CREATE TABLE "x" ("a" "int") ENGINE = MergeTree ORDER BY "x" AS SELECT * FROM "t" WHERE true"#,
226226
);
227+
clickhouse().one_statement_parses_to(
228+
"CREATE TABLE x (a int) ENGINE = MergeTree() ORDER BY a",
229+
"CREATE TABLE x (a INT) ENGINE = MergeTree ORDER BY a",
230+
);
227231
}
228232

229233
#[test]

0 commit comments

Comments
 (0)