alamb commented on code in PR #15166:
URL: https://github.com/apache/datafusion/pull/15166#discussion_r1991814618


##########
datafusion/sql/src/parser.rs:
##########
@@ -620,15 +637,35 @@ impl<'a> DFParser<'a> {
     pub fn parse_explain(&mut self) -> Result<Statement, ParserError> {
         let analyze = self.parser.parse_keyword(Keyword::ANALYZE);
         let verbose = self.parser.parse_keyword(Keyword::VERBOSE);
+        let format = self.parse_explain_format()?;
+
         let statement = self.parse_statement()?;
 
         Ok(Statement::Explain(ExplainStatement {
             statement: Box::new(statement),
             analyze,
             verbose,
+            format,
         }))
     }
 
+    pub fn parse_explain_format(&mut self) -> Result<Option<String>, 
ParserError> {
+        if !self.parser.parse_keyword(Keyword::FORMAT) {
+            return Ok(None);
+        }
+
+        let next_token = self.parser.next_token();
+        let format = match next_token.token {
+            Token::Word(w) => Ok(w.value),
+            Token::SingleQuotedString(w) => Ok(w),
+            Token::DoubleQuotedString(w) => Ok(w),
+            _ => self
+                .parser
+                .expected("an explain format like JSON or TREE", next_token),

Review Comment:
   ```suggestion
                   .expected("an explain format like INDENT or TREE", 
next_token),
   ```



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