You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@datafusion.apache.org by if...@apache.org on 2025/01/16 08:27:32 UTC

(datafusion-sqlparser-rs) branch main updated: Allow empty options for BigQuery (#1657)

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

iffyio pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 9105cae2 Allow empty options for BigQuery (#1657)
9105cae2 is described below

commit 9105cae261bb29d4235b47e86c99c11909a4a3fb
Author: Martin Abelson Sahlen <ma...@gmail.com>
AuthorDate: Thu Jan 16 10:27:26 2025 +0200

    Allow empty options for BigQuery (#1657)
    
    Co-authored-by: Martin Abelson Sahlen <sa...@Mac.lan>
---
 src/parser/mod.rs           | 2 +-
 tests/sqlparser_bigquery.rs | 6 ++++++
 2 files changed, 7 insertions(+), 1 deletion(-)

diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index ac764a53..861a392d 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -7341,7 +7341,7 @@ impl<'a> Parser<'a> {
     pub fn parse_options(&mut self, keyword: Keyword) -> Result<Vec<SqlOption>, ParserError> {
         if self.parse_keyword(keyword) {
             self.expect_token(&Token::LParen)?;
-            let options = self.parse_comma_separated(Parser::parse_sql_option)?;
+            let options = self.parse_comma_separated0(Parser::parse_sql_option, Token::RParen)?;
             self.expect_token(&Token::RParen)?;
             Ok(options)
         } else {
diff --git a/tests/sqlparser_bigquery.rs b/tests/sqlparser_bigquery.rs
index 9dfabc01..a173a6cc 100644
--- a/tests/sqlparser_bigquery.rs
+++ b/tests/sqlparser_bigquery.rs
@@ -473,6 +473,12 @@ fn parse_create_table_with_options() {
         r#"description = "table option description")"#
     );
     bigquery().verified_stmt(sql);
+
+    let sql = "CREATE TABLE foo (x INT64) OPTIONS()";
+    bigquery().verified_stmt(sql);
+
+    let sql = "CREATE TABLE db.schema.test (x INT64 OPTIONS(description = 'An optional INTEGER field')) OPTIONS()";
+    bigquery().verified_stmt(sql);
 }
 
 #[test]


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@datafusion.apache.org
For additional commands, e-mail: commits-help@datafusion.apache.org