Apache DataFusion SQL Query Engine
Implement tree explain for UnionExec (#15278)
zeb7498ebee8f03
diff --git a/datafusion/physical-plan/src/union.rs b/datafusion/physical-plan/src/union.rsindex 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.sltindex 3f71a7a4f4..22b1b46019 100644--- a/datafusion/sqllogictest/test_files/explain_tree.slt+++ b/datafusion/sqllogictest/test_files/explain_tree.slt@@ -1541,6 +1541,32 @@ physical_plan71)│ 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)-----------------------------└───────────────────────────┘+# cleanupstatement okdrop table t1;@@ -2000,6 +2026,10 @@ physical_plan58)│ rows: 1 │59)└───────────────────────────┘+# clean up+statement ok+drop table t1;+# Test explain tree for LazyMemoryExecquery TTEXPLAIN SELECT * FROM generate_series(1, 100)