This is an automated email from the ASF dual-hosted git repository.

github-bot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion-sqlparser-rs.git


The following commit(s) were added to refs/heads/main by this push:
     new 00da3d71 MySQL: Add missing support for TREE explain format (#2145)
00da3d71 is described below

commit 00da3d71fc8e0e11ed14dffadc18ef349f371007
Author: Yoav Cohen <[email protected]>
AuthorDate: Fri Jan 9 10:35:03 2026 +0100

    MySQL: Add missing support for TREE explain format (#2145)
---
 src/keywords.rs           |  1 +
 src/parser/mod.rs         |  1 +
 tests/sqlparser_common.rs | 36 ++++++++++++++++++++++++++++++++++++
 3 files changed, 38 insertions(+)

diff --git a/src/keywords.rs b/src/keywords.rs
index 87c77379..845d7102 100644
--- a/src/keywords.rs
+++ b/src/keywords.rs
@@ -1040,6 +1040,7 @@ define_keywords!(
     TRANSLATE_REGEX,
     TRANSLATION,
     TREAT,
+    TREE,
     TRIGGER,
     TRIM,
     TRIM_ARRAY,
diff --git a/src/parser/mod.rs b/src/parser/mod.rs
index 3a31d925..e436a7af 100644
--- a/src/parser/mod.rs
+++ b/src/parser/mod.rs
@@ -6006,6 +6006,7 @@ impl<'a> Parser<'a> {
                 Keyword::TEXT => Ok(AnalyzeFormat::TEXT),
                 Keyword::GRAPHVIZ => Ok(AnalyzeFormat::GRAPHVIZ),
                 Keyword::JSON => Ok(AnalyzeFormat::JSON),
+                Keyword::TREE => Ok(AnalyzeFormat::TREE),
                 _ => self.expected("fileformat", next_token),
             },
             _ => self.expected("fileformat", next_token),
diff --git a/tests/sqlparser_common.rs b/tests/sqlparser_common.rs
index 9ed59eac..d3f85aff 100644
--- a/tests/sqlparser_common.rs
+++ b/tests/sqlparser_common.rs
@@ -5442,6 +5442,42 @@ fn parse_explain_analyze_with_simple_select() {
         Some(AnalyzeFormatKind::Keyword(AnalyzeFormat::TEXT)),
         None,
     );
+
+    run_explain_analyze(
+        all_dialects(),
+        "EXPLAIN FORMAT=TEXT SELECT sqrt(id) FROM foo",
+        false,
+        false,
+        Some(AnalyzeFormatKind::Assignment(AnalyzeFormat::TEXT)),
+        None,
+    );
+
+    run_explain_analyze(
+        all_dialects(),
+        "EXPLAIN FORMAT=GRAPHVIZ SELECT sqrt(id) FROM foo",
+        false,
+        false,
+        Some(AnalyzeFormatKind::Assignment(AnalyzeFormat::GRAPHVIZ)),
+        None,
+    );
+
+    run_explain_analyze(
+        all_dialects(),
+        "EXPLAIN FORMAT=JSON SELECT sqrt(id) FROM foo",
+        false,
+        false,
+        Some(AnalyzeFormatKind::Assignment(AnalyzeFormat::JSON)),
+        None,
+    );
+
+    run_explain_analyze(
+        all_dialects(),
+        "EXPLAIN FORMAT=TREE SELECT sqrt(id) FROM foo",
+        false,
+        false,
+        Some(AnalyzeFormatKind::Assignment(AnalyzeFormat::TREE)),
+        None,
+    );
 }
 
 #[test]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to