Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions datafusion/physical-plan/src/filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -505,6 +505,9 @@ impl DisplayAs for FilterExec {
)
}
DisplayFormatType::TreeRender => {
if let Some(fetch) = self.fetch {
writeln!(f, "fetch={fetch}")?;
}
write!(f, "predicate={}", fmt_sql(self.predicate.as_ref()))
}
}
Expand Down
92 changes: 48 additions & 44 deletions datafusion/sqllogictest/test_files/explain_tree.slt
Original file line number Diff line number Diff line change
Expand Up @@ -1551,24 +1551,26 @@ physical_plan
09)┌─────────────┴─────────────┐
10)│ FilterExec │
11)│ -------------------- │
12)│ predicate: │
13)│ date = 2006-01-02 │
14)└─────────────┬─────────────┘
15)┌─────────────┴─────────────┐
16)│ RepartitionExec │
17)│ -------------------- │
18)│ partition_count(in->out): │
19)│ 1 -> 4 │
20)│ │
21)│ partitioning_scheme: │
22)│ RoundRobinBatch(4) │
23)└─────────────┬─────────────┘
24)┌─────────────┴─────────────┐
25)│ StreamingTableExec │
26)│ -------------------- │
27)│ infinite: true │
28)│ limit: None │
29)└───────────────────────────┘
12)│ fetch: 5 │
13)│ │
14)│ predicate: │
15)│ date = 2006-01-02 │
16)└─────────────┬─────────────┘
17)┌─────────────┴─────────────┐
18)│ RepartitionExec │
19)│ -------------------- │
20)│ partition_count(in->out): │
21)│ 1 -> 4 │
22)│ │
23)│ partitioning_scheme: │
24)│ RoundRobinBatch(4) │
25)└─────────────┬─────────────┘
26)┌─────────────┴─────────────┐
27)│ StreamingTableExec │
28)│ -------------------- │
29)│ infinite: true │
30)│ limit: None │
31)└───────────────────────────┘



Expand Down Expand Up @@ -1775,15 +1777,16 @@ physical_plan
40)┌─────────────┴─────────────┐
41)│ FilterExec │
42)│ -------------------- │
43)│ predicate: a > 3 │
44)└─────────────┬─────────────┘
45)┌─────────────┴─────────────┐
46)│ DataSourceExec │
47)│ -------------------- │
48)│ bytes: 160 │
49)│ format: memory │
50)│ rows: 1 │
51)└───────────────────────────┘
43)│ fetch: 9 │
44)│ predicate: a > 3 │
45)└─────────────┬─────────────┘
46)┌─────────────┴─────────────┐
47)│ DataSourceExec │
48)│ -------------------- │
49)│ bytes: 160 │
50)│ format: memory │
51)│ rows: 1 │
52)└───────────────────────────┘

# clean up
statement ok
Expand Down Expand Up @@ -1815,23 +1818,24 @@ physical_plan
06)┌─────────────┴─────────────┐
07)│ FilterExec │
08)│ -------------------- │
09)│ predicate: c3 > 0 │
10)└─────────────┬─────────────┘
11)┌─────────────┴─────────────┐
12)│ RepartitionExec │
13)│ -------------------- │
14)│ partition_count(in->out): │
15)│ 1 -> 4 │
16)│ │
17)│ partitioning_scheme: │
18)│ RoundRobinBatch(4) │
19)└─────────────┬─────────────┘
20)┌─────────────┴─────────────┐
21)│ StreamingTableExec │
22)│ -------------------- │
23)│ infinite: true │
24)│ limit: None │
25)└───────────────────────────┘
09)│ fetch: 5 │
10)│ predicate: c3 > 0 │
11)└─────────────┬─────────────┘
12)┌─────────────┴─────────────┐
13)│ RepartitionExec │
14)│ -------------------- │
15)│ partition_count(in->out): │
16)│ 1 -> 4 │
17)│ │
18)│ partitioning_scheme: │
19)│ RoundRobinBatch(4) │
20)└─────────────┬─────────────┘
21)┌─────────────┴─────────────┐
22)│ StreamingTableExec │
23)│ -------------------- │
24)│ infinite: true │
25)│ limit: None │
26)└───────────────────────────┘

# Test explain tree for PlaceholderRowExec
query TT
Expand Down
21 changes: 20 additions & 1 deletion datafusion/sqllogictest/test_files/limit.slt
Original file line number Diff line number Diff line change
Expand Up @@ -385,6 +385,25 @@ SELECT COUNT(*) FROM (SELECT a FROM t1 WHERE a > 3 LIMIT 3 OFFSET 6);
----
1

# Verify that EXPLAIN FORMAT TREE shows fetch on FilterExec
query TT
EXPLAIN FORMAT TREE SELECT a FROM t1 WHERE a > 3 LIMIT 5;
----
physical_plan
01)┌───────────────────────────┐
02)│ FilterExec │
03)│ -------------------- │
04)│ fetch: 5 │
05)│ predicate: a > 3 │
06)└─────────────┬─────────────┘
07)┌─────────────┴─────────────┐
08)│ DataSourceExec │
09)│ -------------------- │
10)│ bytes: 160 │
11)│ format: memory │
12)│ rows: 1 │
13)└───────────────────────────┘

# generate BIGINT data from 1 to 1000 in multiple partitions
statement ok
CREATE TABLE t1000 (i BIGINT) AS
Expand Down Expand Up @@ -867,7 +886,7 @@ limit 1000;

# Config reset

# The SLT runner sets `target_partitions` to 4 instead of using the default, so
# The SLT runner sets `target_partitions` to 4 instead of using the default, so
# reset it explicitly.
statement ok
set datafusion.execution.target_partitions = 4;
Expand Down
Loading