-
Notifications
You must be signed in to change notification settings - Fork 601
Allow empty options for BigQuery #1657
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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); | ||
} | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can we add these as scenarios into the existing tests for the feature vs having them as dedicated tests? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It shall be done! How did I miss that, I was searching but my bad! |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would something like this work to simplify the condition?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was not aware of this one, but it seems to break here:
when it looks like this
I will work a bit to see what is going wrong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The logic in the function
parse_comma_separated0
should be equivalent to what I did alreadyThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried changing both
parse_options
andparse_options_with_keywords
as they excibit similar behaviour but I cannot get the tests to pass, although my original use case is working. It could be that I've stumbled upon some deeper issue or bug though (or I dont know enough about the code base which is clearly the case). The question is whether this potential bug should be addressed in this PR or not. Based on the expected bevahour of the function you suggested this seems like a bug.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, I think I found the bug, if I do this:
its is working. And this leads me to look at the
parse_comma_separated0
implementation. Should this not also consume theend_token
parameter?Ok I tried making this function consume the end_token but it seems to cause more issues. I also saw that there is a
parse_options_with_keywords
that at the moment will not accept an empty options, but I will not change or touch that in this PR.