This is an automated email from the ASF dual-hosted git repository. github-bot pushed a commit to branch gh-readonly-queue/main/pr-2268-b6003eb98e721943c711672571d7cf252c42ae2b in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git
commit 3fa71143b5a3bd5c97dc94999e0a1652fefd389f Author: Andriy Romanov <[email protected]> AuthorDate: Mon Mar 9 02:28:09 2026 -0700 Fixed parsing `OPTIONS(format = 'CSV')` when creating external bigquery table (#2268) --- src/parser/mod.rs | 2 ++ tests/sqlparser_bigquery.rs | 10 ++++++++++ 2 files changed, 12 insertions(+) diff --git a/src/parser/mod.rs b/src/parser/mod.rs index f9432f86..274449ff 100644 --- a/src/parser/mod.rs +++ b/src/parser/mod.rs @@ -6297,6 +6297,8 @@ impl<'a> Parser<'a> { let table_properties = self.parse_options(Keyword::TBLPROPERTIES)?; let table_options = if !table_properties.is_empty() { CreateTableOptions::TableProperties(table_properties) + } else if let Some(options) = self.maybe_parse_options(Keyword::OPTIONS)? { + CreateTableOptions::Options(options) } else { CreateTableOptions::None }; diff --git a/tests/sqlparser_bigquery.rs b/tests/sqlparser_bigquery.rs index ce962cb8..a6b0906f 100644 --- a/tests/sqlparser_bigquery.rs +++ b/tests/sqlparser_bigquery.rs @@ -591,6 +591,16 @@ fn parse_create_table_with_options() { bigquery().verified_stmt(sql); } +#[test] +fn parse_create_external_table_with_options() { + bigquery().verified_stmt( + "CREATE EXTERNAL TABLE dataset_id.table1 (hvr_tx_seq STRING) OPTIONS(format = 'CSV')", + ); + bigquery().verified_stmt( + "CREATE EXTERNAL TABLE dataset_id.table1 (hvr_tx_seq STRING) OPTIONS(format = 'CSV', allow_quoted_newlines = true, encoding = 'UTF8')", + ); +} + #[test] fn parse_nested_data_types() { let sql = "CREATE TABLE table (x STRUCT<a ARRAY<INT64>, b BYTES(42)>, y ARRAY<STRUCT<INT64>>)"; --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
