-
Notifications
You must be signed in to change notification settings - Fork 606
feat: SELECT * REPLACE <Expr> AS <Identifier>
for bigquery
#798
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
2902c66
to
d3929c4
Compare
Pull Request Test Coverage Report for Build 4306895174
💛 - Coveralls |
I'll review in a few hours, really sorry for the delay @togami2864. You're on fire the last weeks hehe |
src/ast/query.rs
Outdated
#[derive(Debug, Clone, PartialEq, PartialOrd, Eq, Ord, Hash)] | ||
#[cfg_attr(feature = "serde", derive(Serialize, Deserialize))] | ||
#[cfg_attr(feature = "visitor", derive(Visit, VisitMut))] | ||
pub enum ReplaceSelectItem { |
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.
Two questions about this structure.
- Why don't you have an enum with two fields, an expression (the field) and another with an identifier?
- Any reason why you put the
AS
as mandatory? BigQuery has it as non-mandatory, but this syntax you displayed here says otherwise.
If you have a select item, the user will have to validate that the select item is not an expression or wildcard, which isn't excellent as we are such that it isn't.
- You'll have to validate the column name expression, as it MUST be an identifier.
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.
- That make sense. It's true that having a select item needs additional validation. I'll modify the implementation.
- I think
AS
is required inSELECT * Replace
statement. This is the special case.
https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_replace
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 check the syntax structure for the select statement: https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax?hl=pt-br#select_list
select_all:
[ expression. ]*
[ EXCEPT ( column_name [, ...] ) ]
[ REPLACE ( expression [ AS ] column_name [, ...] ) ]
AS
is optional between the expression and its column, if I understood it correctly.
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.
Sorry, my bad. Required element is expr
and column_name
.
It looks to me like this PR has some feedback that needs implementing, so marking it as draft. Please mark it as ready for review when it is next ready. |
d3929c4
to
d37e42d
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.
LGTM -- thank you @togami2864
If someone wants to fix it up that would be great. I am would be happy to make another quick follow on release. |
I made #822 to followup. |
Support: https://cloud.google.com/bigquery/docs/reference/standard-sql/query-syntax#select_replace