LucaCappelletti94 commented on code in PR #1707:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1707#discussion_r1950608365


##########
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);

Review Comment:
   Yes, Operator Classes are only used when parsing that portion of the `create 
index` statement that may contain an operator class.
   
   I believe that, in order to ensure the correctness of the parser, it is 
necessary to fully model the operator classes keywords. Otherwise, capturing 
illegal syntax such as operator classes that are not available for a given type 
of index, becomes impossible. For instance, when parsing a GIN index, there 
cannot be a GiST-related operator class.
   
   Using generic strings would not allow for such syntactical validation.



-- 
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

Reply via email to