-
Notifications
You must be signed in to change notification settings - Fork 583
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
Add support for mixed BigQuery table name quoting #971
Conversation
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.
Thank you @iffyio
.flat_map(|ident| { | ||
ident | ||
.value | ||
.split('.') |
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.
does BigQuery support any way to escape .
(like 'foo\.bar'
I wonder 🤔 )
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.
BigQuery didn't support escaping dots in identifiers either as far as I could tell and tested
@@ -84,9 +86,16 @@ fn parse_raw_literal() { | |||
|
|||
#[test] | |||
fn parse_table_identifiers() { | |||
fn test_table_ident(ident: &str, expected: Vec<Ident>) { | |||
fn test_table_ident(ident: &str, canonical: Option<&str>, expected: Vec<Ident>) { |
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.
can you please document what canonical
represents in this context?
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.
Added!
I wonder if you could respond to @MartinNowak 's comment #889 (comment) as well? Aka does this change really need to be in sqlparser-rs? |
I'm not entirely sure I follow, the changes made in this MR were based off my understanding of what was being proposed in that comment, unless I misunderstood - maybe @MartinNowak can clarify otherwise It wouldn't seem reasonable to do this outside the parser - without it, all users of the BigQuery dialect essentially get back wrong object names from the parser in such cases and will need to know to check all identifiers they get back and fix it up with code similar to the MR - effectively re-parsing the object name themself. |
As described in the gh issue, BigQuery accepts arbitrary quoting identifiers within table names - such that e.g: `'a.b.c'` == `'a'.'b'.'c'` == `'a.b'.'c'` are all equivalent. This adds support for such syntax Fixes apache#889
3ff9d91
to
1084ff5
Compare
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.
Thank you @iffyio
Thanks! :) |
Co-authored-by: ifeanyi <[email protected]> # Conflicts: # tests/sqlparser_bigquery.rs
Co-authored-by: ifeanyi <[email protected]>
As described in the gh issue, BigQuery accepts arbitrary quoting identifiers within table names - such that e.g:
'a.b.c'
=='a'.'b'.'c'
=='a.b'.'c'
are all equivalent.This adds support for such syntax
Fixes #889