iffyio commented on code in PR #1657:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1657#discussion_r1917060943


##########
tests/sqlparser_bigquery.rs:
##########
@@ -2244,3 +2244,15 @@ fn test_any_type() {
 fn test_any_type_dont_break_custom_type() {
     bigquery_and_generic().verified_stmt("CREATE TABLE foo (x ANY)");
 }
+
+#[test]
+fn parse_create_table_with_empty_table_options() {
+    let sql = "CREATE TABLE foo (x INT64) OPTIONS()";
+    bigquery().verified_stmt(sql);
+}
+
+#[test]
+fn parse_create_table_with_empty_table_options_and_column_options() {
+    let sql = "CREATE TABLE db.schema.test (x INT64 OPTIONS(description = 'An 
optional INTEGER field')) OPTIONS()";
+    bigquery().verified_stmt(sql);
+}

Review Comment:
   Can we add these as scenarios into the [existing tests for the 
feature](https://github.com/apache/datafusion-sqlparser-rs/blob/c8242d935d763f115cf7cb3efef98880da07f13d/tests/sqlparser_bigquery.rs#L475)
 vs having them as dedicated tests?



##########
src/parser/mod.rs:
##########
@@ -7341,6 +7341,10 @@ 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)?;
+            if self.peek_token() == Token::RParen {
+                self.next_token();
+                return Ok(vec![]);
+            }
             let options = 
self.parse_comma_separated(Parser::parse_sql_option)?;
             self.expect_token(&Token::RParen)?;

Review Comment:
   ```suggestion
               let options = 
self.parse_comma_separated0(Parser::parse_sql_option, &Token::RParen)?;
   ```
   Would something like this work to simplify the condition?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to