Skip to content

Commit 69b0648

Browse files
authored
Implement tree explain for CsvSink (#15204)
1 parent 079ddb0 commit 69b0648

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

datafusion/datasource-csv/src/file_format.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -666,8 +666,10 @@ impl DisplayAs for CsvSink {
666666
write!(f, ")")
667667
}
668668
DisplayFormatType::TreeRender => {
669-
// TODO: collect info
670-
write!(f, "")
669+
if !self.config.file_groups.is_empty() {
670+
FileGroupDisplay(&self.config.file_groups).fmt_as(t, f)?;
671+
}
672+
Ok(())
671673
}
672674
}
673675
}

datafusion/sqllogictest/test_files/explain_tree.slt

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1725,6 +1725,22 @@ physical_plan
17251725
09)│ rows: 1 │
17261726
10)└───────────────────────────┘
17271727

1728+
query TT
1729+
explain COPY (VALUES (1, 'foo', 1, '2023-01-01'), (2, 'bar', 2, '2023-01-02'), (3, 'baz', 3, '2023-01-03'))
1730+
TO 'test_files/scratch/explain_tree/2.csv';
1731+
----
1732+
physical_plan
1733+
01)┌───────────────────────────┐
1734+
02)│ DataSinkExec │
1735+
03)└─────────────┬─────────────┘
1736+
04)┌─────────────┴─────────────┐
1737+
05)│ DataSourceExec │
1738+
06)│ -------------------- │
1739+
07)│ bytes: 2672 │
1740+
08)│ format: memory │
1741+
09)│ rows: 1 │
1742+
10)└───────────────────────────┘
1743+
17281744
# Test explain tree rendering for CoalesceBatchesExec with limit
17291745
statement ok
17301746
CREATE TABLE IF NOT EXISTS t1 (a INT) AS VALUES(1),(2),(3),(4),(5),(6),(7),(8),(9),(10);

0 commit comments

Comments
 (0)