Skip to content

Commit 7498ebe

Browse files
authored
Implement tree explain for UnionExec (#15278)
1 parent 689def2 commit 7498ebe

File tree

2 files changed

+31
-4
lines changed

2 files changed

+31
-4
lines changed

datafusion/physical-plan/src/union.rs

+1-4
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,7 @@ impl DisplayAs for UnionExec {
157157
DisplayFormatType::Default | DisplayFormatType::Verbose => {
158158
write!(f, "UnionExec")
159159
}
160-
DisplayFormatType::TreeRender => {
161-
// TODO: collect info
162-
write!(f, "")
163-
}
160+
DisplayFormatType::TreeRender => Ok(()),
164161
}
165162
}
166163
}

datafusion/sqllogictest/test_files/explain_tree.slt

+30
Original file line numberDiff line numberDiff line change
@@ -1541,6 +1541,32 @@ physical_plan
15411541
71)│ rows: 1 ││ rows: 1 │
15421542
72)└───────────────────────────┘└───────────────────────────┘
15431543

1544+
# Test explain tree for UnionExec
1545+
query TT
1546+
EXPLAIN
1547+
SELECT id, name FROM t1
1548+
UNION ALL
1549+
SELECT id, name FROM t2;
1550+
----
1551+
physical_plan
1552+
01)┌───────────────────────────┐
1553+
02)│ UnionExec ├──────────────┐
1554+
03)└─────────────┬─────────────┘ │
1555+
04)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
1556+
05)│ DataSourceExec ││ ProjectionExec │
1557+
06)│ -------------------- ││ -------------------- │
1558+
07)│ bytes: 1320 ││ id: CAST(id AS Int32) │
1559+
08)│ format: memory ││ name: name │
1560+
09)│ rows: 1 ││ │
1561+
10)└───────────────────────────┘└─────────────┬─────────────┘
1562+
11)-----------------------------┌─────────────┴─────────────┐
1563+
12)-----------------------------│ DataSourceExec │
1564+
13)-----------------------------│ -------------------- │
1565+
14)-----------------------------│ bytes: 1312 │
1566+
15)-----------------------------│ format: memory │
1567+
16)-----------------------------│ rows: 1 │
1568+
17)-----------------------------└───────────────────────────┘
1569+
15441570
# cleanup
15451571
statement ok
15461572
drop table t1;
@@ -2000,6 +2026,10 @@ physical_plan
20002026
58)│ rows: 1 │
20012027
59)└───────────────────────────┘
20022028

2029+
# clean up
2030+
statement ok
2031+
drop table t1;
2032+
20032033
# Test explain tree for LazyMemoryExec
20042034
query TT
20052035
EXPLAIN SELECT * FROM generate_series(1, 100)

0 commit comments

Comments
 (0)