iffyio commented on code in PR #1632:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/1632#discussion_r1913534090
##########
src/parser/mod.rs:
##########
@@ -8738,6 +8738,34 @@ impl<'a> Parser<'a> {
Ok(IdentWithAlias { ident, alias })
}
+ // Optionally parses an alias for a select list item
Review Comment:
```suggestion
/// Optionally parses an alias for a select list item
```
##########
src/parser/mod.rs:
##########
@@ -8738,6 +8738,34 @@ impl<'a> Parser<'a> {
Ok(IdentWithAlias { ident, alias })
}
+ // Optionally parses an alias for a select list item
+ fn maybe_parse_select_item_alias(&mut self) -> Result<Option<Ident>,
ParserError> {
+ let after_as = self.parse_keyword(Keyword::AS);
+ let next_token = self.next_token();
+ match next_token.token {
+ // Dialect-specific behavior for words that may be reserved from
parsed
+ // as select item aliases.
+ Token::Word(w)
+ if self
+ .dialect
+ .is_select_item_alias(after_as, &w.keyword, self) =>
Review Comment:
it looks like the code is simlar to `parse_optional_alias` and they only
differ in this clause? Thinking it would be nice to reuse the logic if so,
maybe we have the shared function taking `reserved_kwds` as an optional
argument and if None is passed, we use `dialect.is_select_item_alias()`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]