Skip to content

Commit de269b7

Browse files
MartinSahlenMartin Abelson Sahlen
authored andcommitted
Allow empty options for BigQuery (apache#1657)
Co-authored-by: Martin Abelson Sahlen <[email protected]>
1 parent 9e3cbc4 commit de269b7

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/parser/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -7351,7 +7351,7 @@ impl<'a> Parser<'a> {
73517351
pub fn parse_options(&mut self, keyword: Keyword) -> Result<Vec<SqlOption>, ParserError> {
73527352
if self.parse_keyword(keyword) {
73537353
self.expect_token(&Token::LParen)?;
7354-
let options = self.parse_comma_separated(Parser::parse_sql_option)?;
7354+
let options = self.parse_comma_separated0(Parser::parse_sql_option, Token::RParen)?;
73557355
self.expect_token(&Token::RParen)?;
73567356
Ok(options)
73577357
} else {

tests/sqlparser_bigquery.rs

+6
Original file line numberDiff line numberDiff line change
@@ -473,6 +473,12 @@ fn parse_create_table_with_options() {
473473
r#"description = "table option description")"#
474474
);
475475
bigquery().verified_stmt(sql);
476+
477+
let sql = "CREATE TABLE foo (x INT64) OPTIONS()";
478+
bigquery().verified_stmt(sql);
479+
480+
let sql = "CREATE TABLE db.schema.test (x INT64 OPTIONS(description = 'An optional INTEGER field')) OPTIONS()";
481+
bigquery().verified_stmt(sql);
476482
}
477483

478484
#[test]

0 commit comments

Comments
 (0)