-
Notifications
You must be signed in to change notification settings - Fork 20
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
Implement EXCEPT and REPLACE in select item #196
Implement EXCEPT and REPLACE in select item #196
Conversation
Replace token.Pos | ||
Rparen token.Pos | ||
|
||
Columns []*StarModifierReplaceItem |
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.
IMO, we can reuse Alias
here instead of introducing a new struct.
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 for your comment. I agree that we can reuse Alias
for it.
I've been avoiding using ast.Alias
for a bit since ast.Alias
is used for both of AS
optional and AS
required and it is not natural to implement parseAlias()
.
May be it is better to introduce parseAlias(requiredAs withAs)
.
- May we better to consider to rename
Alias
toAliasedExpr
? IntroduceTypelessStructLiteralArg
andNewConstructorArg
interfaces #183 (comment)
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.
IMO, it is better to separate between expr AS alias
and expr [AS] alias
.
Currently they are not compatible with parseCommaSeparatedList
unless we have a no-arg named parse*
function.
Additionally, It seems StarModifierReplace
is the first structure having expr AS name[, ...]
.
IMO, this is reason enough to have a separate StarModifierReplaceItem
at this point.
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!
// Note: The text/template notation escapes * to avoid normalize * to - by some formatters | ||
// because the prefix * is ambiguous with bulletin list. |
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.
Good catch.
This PR implements
EXCEPT
andREPLACE
inSelectItem
.Note:
p.lookaheadStarModifierExcept()
to avoid ambiguity between* EXCEPT (columns)
and* EXCEPT ALL
or* EXCEPT DISTINCT
.StarModifier
is borrowed from ZetaSQL: https://github.com/google/zetasql/blob/194cd32b5d766d60e3ca442651d792c7fe54ea74/zetasql/parser/gen_parse_tree.py#L3617-L3634fixes #184