LucaCappelletti94 commented on code in PR #1707: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1707#discussion_r1969583241
########## src/parser/mod.rs: ########## @@ -13337,6 +13376,42 @@ impl<'a> Parser<'a> { }) } + /// Parse an expression, optionally followed by ASC or DESC (used in ORDER BY) + pub fn parse_create_index_expr<OPS: OperatorClass>( + &mut self, + ) -> Result<IndexColumn, ParserError> { + let expr = self.parse_expr()?; + + let operator_class: Option<OPS> = self.parse_one_of_keywords(OPS::KEYWORDS).map(Into::into); + let asc = self.parse_asc_desc(); + + let nulls_first = if self.parse_keywords(&[Keyword::NULLS, Keyword::FIRST]) { + Some(true) + } else if self.parse_keywords(&[Keyword::NULLS, Keyword::LAST]) { + Some(false) + } else { + None + }; + + let with_fill = if dialect_of!(self is ClickHouseDialect | GenericDialect) + && self.parse_keywords(&[Keyword::WITH, Keyword::FILL]) + { + Some(self.parse_with_fill()?) + } else { + None + }; Review Comment: The two function are now dispatched using a boolean const, so no code duplication happens any longer. -- 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