-
Notifications
You must be signed in to change notification settings - Fork 617
feat: bigquery struct literal #817
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
Conversation
0cf0dc0
to
280ddef
Compare
Pull Request Test Coverage Report for Build 4341768952
💛 - Coveralls |
280ddef
to
0d9c5e8
Compare
c8dc171
to
c6610ea
Compare
// TODO: support "ARRAY in STRUCT", "STRUCT in STRUCT" | ||
// let sql = r#"SELECT STRUCT<STRUCT<STRING>>(STRUCT("foo"))"#; | ||
// let select = bigquery().verified_only_select(sql); | ||
// assert_eq!(1, select.projection.len()); | ||
|
||
// let sql = r#"SELECT STRUCT<ARRAY<STRING>>(["foo"])"#; | ||
// let select = bigquery().verified_only_select(sql); | ||
// assert_eq!(1, select.projection.len()); |
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 want to postpone this. I have no idea to parse this now because Lexer treats ">>" as shiftleft.
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.
@togami2864 I think I may have misunderstood your intent -- do you want to postpone the entire PR or just this portion of the syntax?
This PR seems like it waiting for time to respond to feedback, so marking it as a draft |
This builds on top of apache#817 - `STRUCT` literal support via `STRUCT` keyword https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#constructing_a_struct - `STRUCT` and `ARRAY` type declarations https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_an_array_type https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_a_struct_type It works around the issue of not being able to parse nested types like `ARRAY<ARRAY<INT>>` due to the right angle bracket ambiguity where the tokenizer chooses the right-shift operator (this affects other dialects like Hive that have similar syntax). When parsing such types, we accept a closing `>` or `>>` and track which variant is in use in order to preserve correctness. Fixes apache#901 Closes apache#817
This builds on top of apache#817 - `STRUCT` literal support via `STRUCT` keyword https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#constructing_a_struct - `STRUCT` and `ARRAY` type declarations https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_an_array_type https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_a_struct_type It works around the issue of not being able to parse nested types like `ARRAY<ARRAY<INT>>` due to the right angle bracket ambiguity where the tokenizer chooses the right-shift operator (this affects other dialects like Hive that have similar syntax). When parsing such types, we accept a closing `>` or `>>` and track which variant is in use in order to preserve correctness. Fixes apache#901 Closes apache#817
This builds on top of apache#817 - `STRUCT` literal support via `STRUCT` keyword https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#constructing_a_struct - `STRUCT` and `ARRAY` type declarations https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_an_array_type https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_a_struct_type It works around the issue of not being able to parse nested types like `ARRAY<ARRAY<INT>>` due to the right angle bracket ambiguity where the tokenizer chooses the right-shift operator (this affects other dialects like Hive that have similar syntax). When parsing such types, we accept a closing `>` or `>>` and track which variant is in use in order to preserve correctness. Fixes apache#901 Closes apache#817
This builds on top of apache#817 - `STRUCT` literal support via `STRUCT` keyword https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#constructing_a_struct - `STRUCT` and `ARRAY` type declarations https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_an_array_type https://cloud.google.com/bigquery/docs/reference/standard-sql/data-types#declaring_a_struct_type It works around the issue of not being able to parse nested types like `ARRAY<ARRAY<INT>>` due to the right angle bracket ambiguity where the tokenizer chooses the right-shift operator (this affects other dialects like Hive that have similar syntax). When parsing such types, we accept a closing `>` or `>>` and track which variant is in use in order to preserve correctness. Fixes apache#901 Closes apache#817
Support big query struct literal. https://cloud.google.com/bigquery/docs/reference/standard-sql/lexical#struct_literals
This PR includes
Define keywords for struct types
Support three types of struct litral
tuple syntax
typeless struct syntax
typed struct syntax