iffyio commented on code in PR #1599:
URL: 
https://github.com/apache/datafusion-sqlparser-rs/pull/1599#discussion_r1884196275


##########
src/parser/mod.rs:
##########
@@ -851,7 +851,9 @@ impl<'a> Parser<'a> {
     }
 
     pub fn parse_analyze(&mut self) -> Result<Statement, ParserError> {
-        self.expect_keyword(Keyword::TABLE)?;
+        if dialect_of!(self is MySqlDialect | DatabricksDialect | HiveDialect 
| SnowflakeDialect) {
+            self.expect_keyword(Keyword::TABLE)?;
+        }

Review Comment:
   in order to avoid flagging on individual dialects, could we flag on the 
statement whether the keyword was present in the sql? e.g.
   ```rust
   let has_table_keyword = self.parse_keyword(Keyword::TABLE);
   ...
   Ok(Statement::Analyze { has_table_keyword ...})
   ```
   See 
[Statement::Explain](https://github.com/apache/datafusion-sqlparser-rs/blob/8507e452399605cfca98eed11ce4123a5e738333/src/ast/mod.rs#L3219)
 for example. Also 
[here](https://github.com/apache/datafusion-sqlparser-rs/blob/8507e452399605cfca98eed11ce4123a5e738333/src/ast/mod.rs#L3460-L3462)
 for where we serialize the SQL.
   
   That would make it so that the input sql is identical to the output sql.
   
   Also can we add some tests to `sqlparser_common.rs` demonstrate the behavior?
   See 
[hive](https://github.com/apache/datafusion-sqlparser-rs/blob/8507e452399605cfca98eed11ce4123a5e738333/tests/sqlparser_hive.rs#L80-L84)
 for example



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

Reply via email to