pravic commented on code in PR #2024: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2024#discussion_r2332055186
########## src/parser/mod.rs: ########## @@ -12260,6 +12260,27 @@ impl<'a> Parser<'a> { }) } + /// Parse a CTE or CSE. + pub fn parse_cte_or_cse(&mut self) -> Result<CteOrCse, ParserError> { + Ok(if dialect_of!(self is ClickHouseDialect) { + if let Some(cse) = self.maybe_parse(Parser::parse_cse)? { + CteOrCse::Cse(cse) + } else { + CteOrCse::Cte(self.parse_cte()?) + } + } else { + CteOrCse::Cte(self.parse_cte()?) + }) + } + + /// Parse a CSE (`<expr> AS <ident>`). + pub fn parse_cse(&mut self) -> Result<Cse, ParserError> { + let expr = self.parse_expr()?; + let _after_as = self.parse_keyword(Keyword::AS); + let ident = self.parse_identifier()?; Review Comment: I guess, here we need to _expect_ this keyword. -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org