LucaCappelletti94 commented on code in PR #2682:
URL:
https://github.com/apache/datafusion-sqlparser-rs/pull/2682#discussion_r4318270337
##########
src/parser/mod.rs:
##########
@@ -2642,7 +2642,26 @@ impl<'a> Parser<'a> {
let window_spec = self.parse_window_spec()?;
Some(WindowType::WindowSpec(window_spec))
} else {
- Some(WindowType::NamedWindow(self.parse_identifier()?))
+ let next_word_kw = match &self.peek_token_ref().token {
+ Token::Word(w) => Some(w.keyword),
+ _ => None,
+ };
+ let next_is_window_name = match next_word_kw {
+ Some(kw) => {
+ let dialect = self.dialect;
+ dialect.is_column_alias(&kw, self)
+ }
+ None => matches!(
+ &self.peek_token_ref().token,
+ Token::SingleQuotedString(_) |
Token::DoubleQuotedString(_)
+ ),
+ };
+ if self.dialect.supports_over_keyword_as_column_alias() &&
!next_is_window_name {
Review Comment:
The lookahead now runs only when `supports_over_keyword_as_column_alias()`
is true, so other dialects never reach it.
--
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]