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

alamb pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/datafusion.git


The following commit(s) were added to refs/heads/main by this push:
     new 7498ebee8f Implement tree explain for UnionExec (#15278)
7498ebee8f is described below

commit 7498ebee8f033ad35ffe38a2fcd67d41b6477c62
Author: zeb <[email protected]>
AuthorDate: Tue Mar 18 01:44:58 2025 +0800

    Implement tree explain for UnionExec (#15278)
---
 datafusion/physical-plan/src/union.rs              |  5 +---
 .../sqllogictest/test_files/explain_tree.slt       | 30 ++++++++++++++++++++++
 2 files changed, 31 insertions(+), 4 deletions(-)

diff --git a/datafusion/physical-plan/src/union.rs 
b/datafusion/physical-plan/src/union.rs
index 9315e9005b..2b666093f2 100644
--- a/datafusion/physical-plan/src/union.rs
+++ b/datafusion/physical-plan/src/union.rs
@@ -157,10 +157,7 @@ impl DisplayAs for UnionExec {
             DisplayFormatType::Default | DisplayFormatType::Verbose => {
                 write!(f, "UnionExec")
             }
-            DisplayFormatType::TreeRender => {
-                // TODO: collect info
-                write!(f, "")
-            }
+            DisplayFormatType::TreeRender => Ok(()),
         }
     }
 }
diff --git a/datafusion/sqllogictest/test_files/explain_tree.slt 
b/datafusion/sqllogictest/test_files/explain_tree.slt
index 3f71a7a4f4..22b1b46019 100644
--- a/datafusion/sqllogictest/test_files/explain_tree.slt
+++ b/datafusion/sqllogictest/test_files/explain_tree.slt
@@ -1541,6 +1541,32 @@ physical_plan
 71)│          rows: 1          ││          rows: 1          │
 72)└───────────────────────────┘└───────────────────────────┘
 
+# Test explain tree for UnionExec
+query TT
+EXPLAIN
+SELECT id, name FROM t1
+UNION ALL
+SELECT id, name FROM t2;
+----
+physical_plan
+01)┌───────────────────────────┐
+02)│         UnionExec         ├──────────────┐
+03)└─────────────┬─────────────┘              │
+04)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+05)│       DataSourceExec      ││       ProjectionExec      │
+06)│    --------------------   ││    --------------------   │
+07)│        bytes: 1320        ││   id: CAST(id AS Int32)   │
+08)│       format: memory      ││         name: name        │
+09)│          rows: 1          ││                           │
+10)└───────────────────────────┘└─────────────┬─────────────┘
+11)-----------------------------┌─────────────┴─────────────┐
+12)-----------------------------│       DataSourceExec      │
+13)-----------------------------│    --------------------   │
+14)-----------------------------│        bytes: 1312        │
+15)-----------------------------│       format: memory      │
+16)-----------------------------│          rows: 1          │
+17)-----------------------------└───────────────────────────┘
+
 # cleanup
 statement ok
 drop table t1;
@@ -2000,6 +2026,10 @@ physical_plan
 58)│          rows: 1          │
 59)└───────────────────────────┘
 
+# clean up
+statement ok
+drop table t1;
+
 # Test explain tree for LazyMemoryExec
 query TT
 EXPLAIN SELECT * FROM generate_series(1, 100)


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

Reply via email to