alamb commented on code in PR #6291:
URL: https://github.com/apache/arrow-datafusion/pull/6291#discussion_r1188433080


##########
datafusion/sql/src/parser.rs:
##########
@@ -434,16 +434,19 @@ impl<'a> DFParser<'a> {
             } else if self.parser.parse_keyword(Keyword::LOCATION) {
                 ensure_not_set(&builder.location, "LOCATION")?;
                 builder.location = Some(self.parser.parse_literal_string()?);
-            } else if self
-                .parser
-                .parse_keywords(&[Keyword::WITH, Keyword::HEADER])
-            {
-                self.parser.expect_keyword(Keyword::ROW)?;
-                ensure_not_set(&builder.has_header, "WITH HEADER ROW")?;
-                builder.has_header = Some(true);
-            } else if self.parser.parse_keywords(&[Keyword::WITH, 
Keyword::ORDER]) {
-                ensure_not_set(&builder.order_exprs, "WITH ORDER")?;
-                builder.order_exprs = Some(self.parse_order_by_exprs()?);
+            } else if self.parser.parse_keyword(Keyword::WITH) {

Review Comment:
   What do you think about using @tz70s 's suggestion at 
https://github.com/apache/arrow-datafusion/pull/6257#discussion_r1186779655
   
   
https://docs.rs/sqlparser/0.33.0/sqlparser/parser/struct.Parser.html#method.expect_one_of_keywords
   
   Here is an example of how it could be used: 
https://github.com/sqlparser-rs/sqlparser-rs/blob/b29b551fa111bbd50c40568f6aea6c49eafc0b9c/src/parser.rs#L6559-L6562
   
   That would also produce an error message that told the user what keywords 
were expected and what was actually received



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

Reply via email to