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 4b8a2d8450 Implement tree explain for `RepartitionExec` and
`WorkTableExec` (#15137)
4b8a2d8450 is described below
commit 4b8a2d84506b1f340e7332c7e382eb135a7b465c
Author: Alan Tang <[email protected]>
AuthorDate: Wed Mar 12 04:35:26 2025 +0800
Implement tree explain for `RepartitionExec` and `WorkTableExec` (#15137)
* feat: implement tree rendering for RepartitionExec
Signed-off-by: Alan Tang <[email protected]>
* feat: implement tree rendering for WorkTableExec
Signed-off-by: Alan Tang <[email protected]>
* bug: fix clippy error
Signed-off-by: Alan Tang <[email protected]>
---------
Signed-off-by: Alan Tang <[email protected]>
Co-authored-by: Andrew Lamb <[email protected]>
---
datafusion/physical-plan/src/repartition/mod.rs | 12 +-
datafusion/physical-plan/src/work_table.rs | 3 +-
.../sqllogictest/test_files/explain_tree.slt | 765 ++++++++++++++-------
3 files changed, 511 insertions(+), 269 deletions(-)
diff --git a/datafusion/physical-plan/src/repartition/mod.rs
b/datafusion/physical-plan/src/repartition/mod.rs
index e9a360c2ec..2b2548c872 100644
--- a/datafusion/physical-plan/src/repartition/mod.rs
+++ b/datafusion/physical-plan/src/repartition/mod.rs
@@ -507,8 +507,16 @@ impl DisplayAs for RepartitionExec {
Ok(())
}
DisplayFormatType::TreeRender => {
- // TODO: collect info
- write!(f, "")
+ writeln!(f, "partitioning_scheme={}", self.partitioning(),)?;
+ writeln!(
+ f,
+ "output_partition_count={}",
+ self.input.output_partitioning().partition_count()
+ )?;
+ if self.preserve_order {
+ writeln!(f, "preserve_order={}", self.preserve_order)?;
+ }
+ Ok(())
}
}
}
diff --git a/datafusion/physical-plan/src/work_table.rs
b/datafusion/physical-plan/src/work_table.rs
index f082b05410..126a7d0bba 100644
--- a/datafusion/physical-plan/src/work_table.rs
+++ b/datafusion/physical-plan/src/work_table.rs
@@ -163,8 +163,7 @@ impl DisplayAs for WorkTableExec {
write!(f, "WorkTableExec: name={}", self.name)
}
DisplayFormatType::TreeRender => {
- // TODO: collect info
- write!(f, "")
+ write!(f, "name={}", self.name)
}
}
}
diff --git a/datafusion/sqllogictest/test_files/explain_tree.slt
b/datafusion/sqllogictest/test_files/explain_tree.slt
index 45ddcb9a73..7f2f280d3d 100644
--- a/datafusion/sqllogictest/test_files/explain_tree.slt
+++ b/datafusion/sqllogictest/test_files/explain_tree.slt
@@ -151,13 +151,19 @@ physical_plan
09)└─────────────┬─────────────┘
10)┌─────────────┴─────────────┐
11)│ RepartitionExec │
-12)└─────────────┬─────────────┘
-13)┌─────────────┴─────────────┐
-14)│ DataSourceExec │
-15)│ -------------------- │
-16)│ files: 1 │
-17)│ format: csv │
-18)└───────────────────────────┘
+12)│ -------------------- │
+13)│ output_partition_count: │
+14)│ 1 │
+15)│ │
+16)│ partitioning_scheme: │
+17)│ RoundRobinBatch(4) │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│ DataSourceExec │
+21)│ -------------------- │
+22)│ files: 1 │
+23)│ format: csv │
+24)└───────────────────────────┘
# Aggregate
query TT
@@ -181,27 +187,40 @@ physical_plan
15)└─────────────┬─────────────┘
16)┌─────────────┴─────────────┐
17)│ RepartitionExec │
-18)└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐
-20)│ AggregateExec │
-21)│ -------------------- │
-22)│ aggr: │
-23)│ sum(table1.bigint_col) │
-24)│ │
-25)│ group_by: │
-26)│ string_col@0 as string_col│
-27)│ │
-28)│ mode: Partial │
-29)└─────────────┬─────────────┘
-30)┌─────────────┴─────────────┐
-31)│ RepartitionExec │
-32)└─────────────┬─────────────┘
-33)┌─────────────┴─────────────┐
-34)│ DataSourceExec │
-35)│ -------------------- │
-36)│ files: 1 │
-37)│ format: csv │
-38)└───────────────────────────┘
+18)│ -------------------- │
+19)│ output_partition_count: │
+20)│ 4 │
+21)│ │
+22)│ partitioning_scheme: │
+23)│ Hash([string_col@0], 4) │
+24)└─────────────┬─────────────┘
+25)┌─────────────┴─────────────┐
+26)│ AggregateExec │
+27)│ -------------------- │
+28)│ aggr: │
+29)│ sum(table1.bigint_col) │
+30)│ │
+31)│ group_by: │
+32)│ string_col@0 as string_col│
+33)│ │
+34)│ mode: Partial │
+35)└─────────────┬─────────────┘
+36)┌─────────────┴─────────────┐
+37)│ RepartitionExec │
+38)│ -------------------- │
+39)│ output_partition_count: │
+40)│ 1 │
+41)│ │
+42)│ partitioning_scheme: │
+43)│ RoundRobinBatch(4) │
+44)└─────────────┬─────────────┘
+45)┌─────────────┴─────────────┐
+46)│ DataSourceExec │
+47)│ -------------------- │
+48)│ files: 1 │
+49)│ format: csv │
+50)└───────────────────────────┘
+
# Limit
query TT
@@ -240,16 +259,28 @@ physical_plan
12)└─────────────┬─────────────┘└─────────────┬─────────────┘
13)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
14)│ RepartitionExec ││ RepartitionExec │
-15)└─────────────┬─────────────┘└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-17)│ RepartitionExec ││ RepartitionExec │
-18)└─────────────┬─────────────┘└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-20)│ DataSourceExec ││ DataSourceExec │
-21)│ -------------------- ││ -------------------- │
-22)│ files: 1 ││ files: 1 │
-23)│ format: csv ││ format: parquet │
-24)└───────────────────────────┘└───────────────────────────┘
+15)│ -------------------- ││ -------------------- │
+16)│ output_partition_count: ││ output_partition_count: │
+17)│ 4 ││ 4 │
+18)│ ││ │
+19)│ partitioning_scheme: ││ partitioning_scheme: │
+20)│ Hash([int_col@0], 4) ││ Hash([int_col@0], 4) │
+21)└─────────────┬─────────────┘└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+23)│ RepartitionExec ││ RepartitionExec │
+24)│ -------------------- ││ -------------------- │
+25)│ output_partition_count: ││ output_partition_count: │
+26)│ 1 ││ 1 │
+27)│ ││ │
+28)│ partitioning_scheme: ││ partitioning_scheme: │
+29)│ RoundRobinBatch(4) ││ RoundRobinBatch(4) │
+30)└─────────────┬─────────────┘└─────────────┬─────────────┘
+31)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+32)│ DataSourceExec ││ DataSourceExec │
+33)│ -------------------- ││ -------------------- │
+34)│ files: 1 ││ files: 1 │
+35)│ format: csv ││ format: parquet │
+36)└───────────────────────────┘└───────────────────────────┘
# 3 Joins
query TT
@@ -276,29 +307,44 @@ physical_plan
12)└─────────────┬─────────────┘
└─────────────┬─────────────┘
13)┌─────────────┴─────────────┐
┌─────────────┴─────────────┐
14)│ HashJoinExec │ │
RepartitionExec │
-15)│ -------------------- │ │
│
-16)│ on: ├──────────────┐ │
│
-17)│ (int_col@0 = int_col@0) │ │ │
│
-18)└─────────────┬─────────────┘ │
└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-20)│ CoalesceBatchesExec ││ CoalesceBatchesExec ││
DataSourceExec │
-21)│ ││ ││
-------------------- │
-22)│ ││ ││ bytes:
1560 │
-23)│ ││ ││ format:
memory │
-24)│ ││ ││ rows:
1 │
-25)└─────────────┬─────────────┘└─────────────┬─────────────┘└───────────────────────────┘
-26)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-27)│ RepartitionExec ││ RepartitionExec │
-28)└─────────────┬─────────────┘└─────────────┬─────────────┘
+15)│ -------------------- │ │
-------------------- │
+16)│ on: │ │
output_partition_count: │
+17)│ (int_col@0 = int_col@0) ├──────────────┐ │ 1
│
+18)│ │ │ │
│
+19)│ │ │ │
partitioning_scheme: │
+20)│ │ │ │
Hash([int_col@0], 4) │
+21)└─────────────┬─────────────┘ │
└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+23)│ CoalesceBatchesExec ││ CoalesceBatchesExec ││
DataSourceExec │
+24)│ ││ ││
-------------------- │
+25)│ ││ ││ bytes:
1560 │
+26)│ ││ ││ format:
memory │
+27)│ ││ ││ rows:
1 │
+28)└─────────────┬─────────────┘└─────────────┬─────────────┘└───────────────────────────┘
29)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
30)│ RepartitionExec ││ RepartitionExec │
-31)└─────────────┬─────────────┘└─────────────┬─────────────┘
-32)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-33)│ DataSourceExec ││ DataSourceExec │
-34)│ -------------------- ││ -------------------- │
-35)│ files: 1 ││ files: 1 │
-36)│ format: csv ││ format: parquet │
-37)└───────────────────────────┘└───────────────────────────┘
+31)│ -------------------- ││ -------------------- │
+32)│ output_partition_count: ││ output_partition_count: │
+33)│ 4 ││ 4 │
+34)│ ││ │
+35)│ partitioning_scheme: ││ partitioning_scheme: │
+36)│ Hash([int_col@0], 4) ││ Hash([int_col@0], 4) │
+37)└─────────────┬─────────────┘└─────────────┬─────────────┘
+38)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+39)│ RepartitionExec ││ RepartitionExec │
+40)│ -------------------- ││ -------------------- │
+41)│ output_partition_count: ││ output_partition_count: │
+42)│ 1 ││ 1 │
+43)│ ││ │
+44)│ partitioning_scheme: ││ partitioning_scheme: │
+45)│ RoundRobinBatch(4) ││ RoundRobinBatch(4) │
+46)└─────────────┬─────────────┘└─────────────┬─────────────┘
+47)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+48)│ DataSourceExec ││ DataSourceExec │
+49)│ -------------------- ││ -------------------- │
+50)│ files: 1 ││ files: 1 │
+51)│ format: csv ││ format: parquet │
+52)└───────────────────────────┘└───────────────────────────┘
# Long Filter (demonstrate what happens with wrapping)
query TT
@@ -322,13 +368,19 @@ physical_plan
13)└─────────────┬─────────────┘
14)┌─────────────┴─────────────┐
15)│ RepartitionExec │
-16)└─────────────┬─────────────┘
-17)┌─────────────┴─────────────┐
-18)│ DataSourceExec │
-19)│ -------------------- │
-20)│ files: 1 │
-21)│ format: csv │
-22)└───────────────────────────┘
+16)│ -------------------- │
+17)│ output_partition_count: │
+18)│ 1 │
+19)│ │
+20)│ partitioning_scheme: │
+21)│ RoundRobinBatch(4) │
+22)└─────────────┬─────────────┘
+23)┌─────────────┴─────────────┐
+24)│ DataSourceExec │
+25)│ -------------------- │
+26)│ files: 1 │
+27)│ format: csv │
+28)└───────────────────────────┘
# Check maximum line limit.
query TT
@@ -375,13 +427,19 @@ physical_plan
37)└─────────────┬─────────────┘
38)┌─────────────┴─────────────┐
39)│ RepartitionExec │
-40)└─────────────┬─────────────┘
-41)┌─────────────┴─────────────┐
-42)│ DataSourceExec │
-43)│ -------------------- │
-44)│ files: 1 │
-45)│ format: csv │
-46)└───────────────────────────┘
+40)│ -------------------- │
+41)│ output_partition_count: │
+42)│ 1 │
+43)│ │
+44)│ partitioning_scheme: │
+45)│ RoundRobinBatch(4) │
+46)└─────────────┬─────────────┘
+47)┌─────────────┴─────────────┐
+48)│ DataSourceExec │
+49)│ -------------------- │
+50)│ files: 1 │
+51)│ format: csv │
+52)└───────────────────────────┘
# Check exactly the render width.
query TT
@@ -400,13 +458,19 @@ physical_plan
09)└─────────────┬─────────────┘
10)┌─────────────┴─────────────┐
11)│ RepartitionExec │
-12)└─────────────┬─────────────┘
-13)┌─────────────┴─────────────┐
-14)│ DataSourceExec │
-15)│ -------------------- │
-16)│ files: 1 │
-17)│ format: csv │
-18)└───────────────────────────┘
+12)│ -------------------- │
+13)│ output_partition_count: │
+14)│ 1 │
+15)│ │
+16)│ partitioning_scheme: │
+17)│ RoundRobinBatch(4) │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│ DataSourceExec │
+21)│ -------------------- │
+22)│ files: 1 │
+23)│ format: csv │
+24)└───────────────────────────┘
# Check with the render witdth + 1.
query TT
@@ -426,13 +490,19 @@ physical_plan
10)└─────────────┬─────────────┘
11)┌─────────────┴─────────────┐
12)│ RepartitionExec │
-13)└─────────────┬─────────────┘
-14)┌─────────────┴─────────────┐
-15)│ DataSourceExec │
-16)│ -------------------- │
-17)│ files: 1 │
-18)│ format: csv │
-19)└───────────────────────────┘
+13)│ -------------------- │
+14)│ output_partition_count: │
+15)│ 1 │
+16)│ │
+17)│ partitioning_scheme: │
+18)│ RoundRobinBatch(4) │
+19)└─────────────┬─────────────┘
+20)┌─────────────┴─────────────┐
+21)│ DataSourceExec │
+22)│ -------------------- │
+23)│ files: 1 │
+24)│ format: csv │
+25)└───────────────────────────┘
# Query with filter on csv
query TT
@@ -450,13 +520,19 @@ physical_plan
09)└─────────────┬─────────────┘
10)┌─────────────┴─────────────┐
11)│ RepartitionExec │
-12)└─────────────┬─────────────┘
-13)┌─────────────┴─────────────┐
-14)│ DataSourceExec │
-15)│ -------------------- │
-16)│ files: 1 │
-17)│ format: csv │
-18)└───────────────────────────┘
+12)│ -------------------- │
+13)│ output_partition_count: │
+14)│ 1 │
+15)│ │
+16)│ partitioning_scheme: │
+17)│ RoundRobinBatch(4) │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│ DataSourceExec │
+21)│ -------------------- │
+22)│ files: 1 │
+23)│ format: csv │
+24)└───────────────────────────┘
# Query with filter on parquet
@@ -475,16 +551,22 @@ physical_plan
09)└─────────────┬─────────────┘
10)┌─────────────┴─────────────┐
11)│ RepartitionExec │
-12)└─────────────┬─────────────┘
-13)┌─────────────┴─────────────┐
-14)│ DataSourceExec │
-15)│ -------------------- │
-16)│ files: 1 │
-17)│ format: parquet │
-18)│ │
-19)│ predicate: │
-20)│ string_col@1 != foo │
-21)└───────────────────────────┘
+12)│ -------------------- │
+13)│ output_partition_count: │
+14)│ 1 │
+15)│ │
+16)│ partitioning_scheme: │
+17)│ RoundRobinBatch(4) │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│ DataSourceExec │
+21)│ -------------------- │
+22)│ files: 1 │
+23)│ format: parquet │
+24)│ │
+25)│ predicate: │
+26)│ string_col@1 != foo │
+27)└───────────────────────────┘
# Query with filter on memory
query TT
@@ -524,13 +606,19 @@ physical_plan
09)└─────────────┬─────────────┘
10)┌─────────────┴─────────────┐
11)│ RepartitionExec │
-12)└─────────────┬─────────────┘
-13)┌─────────────┴─────────────┐
-14)│ DataSourceExec │
-15)│ -------------------- │
-16)│ files: 1 │
-17)│ format: json │
-18)└───────────────────────────┘
+12)│ -------------------- │
+13)│ output_partition_count: │
+14)│ 1 │
+15)│ │
+16)│ partitioning_scheme: │
+17)│ RoundRobinBatch(4) │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│ DataSourceExec │
+21)│ -------------------- │
+22)│ files: 1 │
+23)│ format: json │
+24)└───────────────────────────┘
# Query with filter on arrow
query TT
@@ -548,13 +636,19 @@ physical_plan
09)└─────────────┬─────────────┘
10)┌─────────────┴─────────────┐
11)│ RepartitionExec │
-12)└─────────────┬─────────────┘
-13)┌─────────────┴─────────────┐
-14)│ DataSourceExec │
-15)│ -------------------- │
-16)│ files: 1 │
-17)│ format: arrow │
-18)└───────────────────────────┘
+12)│ -------------------- │
+13)│ output_partition_count: │
+14)│ 1 │
+15)│ │
+16)│ partitioning_scheme: │
+17)│ RoundRobinBatch(4) │
+18)└─────────────┬─────────────┘
+19)┌─────────────┴─────────────┐
+20)│ DataSourceExec │
+21)│ -------------------- │
+22)│ files: 1 │
+23)│ format: arrow │
+24)└───────────────────────────┘
# Query with window agg.
@@ -732,13 +826,19 @@ physical_plan
12)└─────────────┬─────────────┘
13)┌─────────────┴─────────────┐
14)│ RepartitionExec │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│ DataSourceExec │
-18)│ -------------------- │
-19)│ files: 1 │
-20)│ format: csv │
-21)└───────────────────────────┘
+15)│ -------------------- │
+16)│ output_partition_count: │
+17)│ 1 │
+18)│ │
+19)│ partitioning_scheme: │
+20)│ RoundRobinBatch(4) │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│ DataSourceExec │
+24)│ -------------------- │
+25)│ files: 1 │
+26)│ format: csv │
+27)└───────────────────────────┘
query TT
explain select
@@ -835,13 +935,19 @@ physical_plan
12)└─────────────┬─────────────┘
13)┌─────────────┴─────────────┐
14)│ RepartitionExec │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│ DataSourceExec │
-18)│ -------------------- │
-19)│ files: 1 │
-20)│ format: parquet │
-21)└───────────────────────────┘
+15)│ -------------------- │
+16)│ output_partition_count: │
+17)│ 1 │
+18)│ │
+19)│ partitioning_scheme: │
+20)│ RoundRobinBatch(4) │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│ DataSourceExec │
+24)│ -------------------- │
+25)│ files: 1 │
+26)│ format: parquet │
+27)└───────────────────────────┘
# Query with projection on memory
@@ -887,13 +993,19 @@ physical_plan
11)└─────────────┬─────────────┘
12)┌─────────────┴─────────────┐
13)│ RepartitionExec │
-14)└─────────────┬─────────────┘
-15)┌─────────────┴─────────────┐
-16)│ DataSourceExec │
-17)│ -------------------- │
-18)│ files: 1 │
-19)│ format: json │
-20)└───────────────────────────┘
+14)│ -------------------- │
+15)│ output_partition_count: │
+16)│ 1 │
+17)│ │
+18)│ partitioning_scheme: │
+19)│ RoundRobinBatch(4) │
+20)└─────────────┬─────────────┘
+21)┌─────────────┴─────────────┐
+22)│ DataSourceExec │
+23)│ -------------------- │
+24)│ files: 1 │
+25)│ format: json │
+26)└───────────────────────────┘
# Query with projection on arrow
@@ -915,13 +1027,19 @@ physical_plan
12)└─────────────┬─────────────┘
13)┌─────────────┴─────────────┐
14)│ RepartitionExec │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│ DataSourceExec │
-18)│ -------------------- │
-19)│ files: 1 │
-20)│ format: arrow │
-21)└───────────────────────────┘
+15)│ -------------------- │
+16)│ output_partition_count: │
+17)│ 1 │
+18)│ │
+19)│ partitioning_scheme: │
+20)│ RoundRobinBatch(4) │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│ DataSourceExec │
+24)│ -------------------- │
+25)│ files: 1 │
+26)│ format: arrow │
+27)└───────────────────────────┘
# Query with PartialSortExec.
query TT
@@ -989,36 +1107,47 @@ physical_plan
15)└─────────────┬─────────────┘└─────────────┬─────────────┘
16)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
17)│ RepartitionExec ││ RepartitionExec │
-18)└─────────────┬─────────────┘└─────────────┬─────────────┘
-19)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-20)│ ProjectionExec ││ RepartitionExec │
-21)│ -------------------- ││ │
-22)│ CAST(table1.string_col AS ││ │
-23)│ Utf8View): ││ │
-24)│ CAST(string_col@1 AS ││ │
-25)│ Utf8View) ││ │
-26)│ ││ │
-27)│ bigint_col: ││ │
-28)│ bigint_col@2 ││ │
-29)│ ││ │
-30)│ date_col: date_col@3 ││ │
-31)│ int_col: int_col@0 ││ │
-32)│ ││ │
-33)│ string_col: ││ │
-34)│ string_col@1 ││ │
-35)└─────────────┬─────────────┘└─────────────┬─────────────┘
-36)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-37)│ RepartitionExec ││ DataSourceExec │
-38)│ ││ -------------------- │
-39)│ ││ files: 1 │
-40)│ ││ format: parquet │
-41)└─────────────┬─────────────┘└───────────────────────────┘
-42)┌─────────────┴─────────────┐
-43)│ DataSourceExec │
-44)│ -------------------- │
-45)│ files: 1 │
-46)│ format: csv │
-47)└───────────────────────────┘
+18)│ -------------------- ││ -------------------- │
+19)│ output_partition_count: ││ output_partition_count: │
+20)│ 4 ││ 4 │
+21)│ ││ │
+22)│ partitioning_scheme: ││ partitioning_scheme: │
+23)│ Hash([int_col@0, CAST ││ Hash([int_col@0, │
+24)│ (table1.string_col ││ string_col@1], │
+25)│ AS Utf8View)@4], 4) ││ 4) │
+26)└─────────────┬─────────────┘└─────────────┬─────────────┘
+27)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+28)│ ProjectionExec ││ RepartitionExec │
+29)│ -------------------- ││ -------------------- │
+30)│ CAST(table1.string_col AS ││ output_partition_count: │
+31)│ Utf8View): ││ 1 │
+32)│ CAST(string_col@1 AS ││ │
+33)│ Utf8View) ││ partitioning_scheme: │
+34)│ ││ RoundRobinBatch(4) │
+35)│ bigint_col: ││ │
+36)│ bigint_col@2 ││ │
+37)│ ││ │
+38)│ date_col: date_col@3 ││ │
+39)│ int_col: int_col@0 ││ │
+40)│ ││ │
+41)│ string_col: ││ │
+42)│ string_col@1 ││ │
+43)└─────────────┬─────────────┘└─────────────┬─────────────┘
+44)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+45)│ RepartitionExec ││ DataSourceExec │
+46)│ -------------------- ││ -------------------- │
+47)│ output_partition_count: ││ files: 1 │
+48)│ 1 ││ format: parquet │
+49)│ ││ │
+50)│ partitioning_scheme: ││ │
+51)│ RoundRobinBatch(4) ││ │
+52)└─────────────┬─────────────┘└───────────────────────────┘
+53)┌─────────────┴─────────────┐
+54)│ DataSourceExec │
+55)│ -------------------- │
+56)│ files: 1 │
+57)│ format: csv │
+58)└───────────────────────────┘
# Query with outer hash join.
query TT
@@ -1044,36 +1173,47 @@ physical_plan
17)└─────────────┬─────────────┘└─────────────┬─────────────┘
18)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
19)│ RepartitionExec ││ RepartitionExec │
-20)└─────────────┬─────────────┘└─────────────┬─────────────┘
-21)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-22)│ ProjectionExec ││ RepartitionExec │
-23)│ -------------------- ││ │
-24)│ CAST(table1.string_col AS ││ │
-25)│ Utf8View): ││ │
-26)│ CAST(string_col@1 AS ││ │
-27)│ Utf8View) ││ │
-28)│ ││ │
-29)│ bigint_col: ││ │
-30)│ bigint_col@2 ││ │
-31)│ ││ │
-32)│ date_col: date_col@3 ││ │
-33)│ int_col: int_col@0 ││ │
-34)│ ││ │
-35)│ string_col: ││ │
-36)│ string_col@1 ││ │
-37)└─────────────┬─────────────┘└─────────────┬─────────────┘
-38)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
-39)│ RepartitionExec ││ DataSourceExec │
-40)│ ││ -------------------- │
-41)│ ││ files: 1 │
-42)│ ││ format: parquet │
-43)└─────────────┬─────────────┘└───────────────────────────┘
-44)┌─────────────┴─────────────┐
-45)│ DataSourceExec │
-46)│ -------------------- │
-47)│ files: 1 │
-48)│ format: csv │
-49)└───────────────────────────┘
+20)│ -------------------- ││ -------------------- │
+21)│ output_partition_count: ││ output_partition_count: │
+22)│ 4 ││ 4 │
+23)│ ││ │
+24)│ partitioning_scheme: ││ partitioning_scheme: │
+25)│ Hash([int_col@0, CAST ││ Hash([int_col@0, │
+26)│ (table1.string_col ││ string_col@1], │
+27)│ AS Utf8View)@4], 4) ││ 4) │
+28)└─────────────┬─────────────┘└─────────────┬─────────────┘
+29)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+30)│ ProjectionExec ││ RepartitionExec │
+31)│ -------------------- ││ -------------------- │
+32)│ CAST(table1.string_col AS ││ output_partition_count: │
+33)│ Utf8View): ││ 1 │
+34)│ CAST(string_col@1 AS ││ │
+35)│ Utf8View) ││ partitioning_scheme: │
+36)│ ││ RoundRobinBatch(4) │
+37)│ bigint_col: ││ │
+38)│ bigint_col@2 ││ │
+39)│ ││ │
+40)│ date_col: date_col@3 ││ │
+41)│ int_col: int_col@0 ││ │
+42)│ ││ │
+43)│ string_col: ││ │
+44)│ string_col@1 ││ │
+45)└─────────────┬─────────────┘└─────────────┬─────────────┘
+46)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+47)│ RepartitionExec ││ DataSourceExec │
+48)│ -------------------- ││ -------------------- │
+49)│ output_partition_count: ││ files: 1 │
+50)│ 1 ││ format: parquet │
+51)│ ││ │
+52)│ partitioning_scheme: ││ │
+53)│ RoundRobinBatch(4) ││ │
+54)└─────────────┬─────────────┘└───────────────────────────┘
+55)┌─────────────┴─────────────┐
+56)│ DataSourceExec │
+57)│ -------------------- │
+58)│ files: 1 │
+59)│ format: csv │
+60)└───────────────────────────┘
# Query with nested loop join.
query TT
@@ -1108,13 +1248,19 @@ physical_plan
26)-----------------------------└─────────────┬─────────────┘
27)-----------------------------┌─────────────┴─────────────┐
28)-----------------------------│ RepartitionExec │
-29)-----------------------------└─────────────┬─────────────┘
-30)-----------------------------┌─────────────┴─────────────┐
-31)-----------------------------│ DataSourceExec │
-32)-----------------------------│ -------------------- │
-33)-----------------------------│ files: 1 │
-34)-----------------------------│ format: parquet │
-35)-----------------------------└───────────────────────────┘
+29)-----------------------------│ -------------------- │
+30)-----------------------------│ output_partition_count: │
+31)-----------------------------│ 1 │
+32)-----------------------------│ │
+33)-----------------------------│ partitioning_scheme: │
+34)-----------------------------│ RoundRobinBatch(4) │
+35)-----------------------------└─────────────┬─────────────┘
+36)-----------------------------┌─────────────┴─────────────┐
+37)-----------------------------│ DataSourceExec │
+38)-----------------------------│ -------------------- │
+39)-----------------------------│ files: 1 │
+40)-----------------------------│ format: parquet │
+41)-----------------------------└───────────────────────────┘
# Query with cross join.
query TT
@@ -1126,16 +1272,19 @@ physical_plan
03)└─────────────┬─────────────┘ │
04)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
05)│ DataSourceExec ││ RepartitionExec │
-06)│ -------------------- ││ │
-07)│ files: 1 ││ │
-08)│ format: csv ││ │
-09)└───────────────────────────┘└─────────────┬─────────────┘
-10)-----------------------------┌─────────────┴─────────────┐
-11)-----------------------------│ DataSourceExec │
-12)-----------------------------│ -------------------- │
-13)-----------------------------│ files: 1 │
-14)-----------------------------│ format: parquet │
-15)-----------------------------└───────────────────────────┘
+06)│ -------------------- ││ -------------------- │
+07)│ files: 1 ││ output_partition_count: │
+08)│ format: csv ││ 1 │
+09)│ ││ │
+10)│ ││ partitioning_scheme: │
+11)│ ││ RoundRobinBatch(4) │
+12)└───────────────────────────┘└─────────────┬─────────────┘
+13)-----------------------------┌─────────────┴─────────────┐
+14)-----------------------------│ DataSourceExec │
+15)-----------------------------│ -------------------- │
+16)-----------------------------│ files: 1 │
+17)-----------------------------│ format: parquet │
+18)-----------------------------└───────────────────────────┘
# Query with sort merge join.
@@ -1216,13 +1365,19 @@ physical_plan
12)└─────────────┬─────────────┘
13)┌─────────────┴─────────────┐
14)│ RepartitionExec │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│ StreamingTableExec │
-18)│ -------------------- │
-19)│ infinite: true │
-20)│ limit: None │
-21)└───────────────────────────┘
+15)│ -------------------- │
+16)│ output_partition_count: │
+17)│ 1 │
+18)│ │
+19)│ partitioning_scheme: │
+20)│ RoundRobinBatch(4) │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│ StreamingTableExec │
+24)│ -------------------- │
+25)│ infinite: true │
+26)│ limit: None │
+27)└───────────────────────────┘
# constant ticker, CAST(time AS DATE) = time, order by time
@@ -1247,13 +1402,19 @@ physical_plan
13)└─────────────┬─────────────┘
14)┌─────────────┴─────────────┐
15)│ RepartitionExec │
-16)└─────────────┬─────────────┘
-17)┌─────────────┴─────────────┐
-18)│ StreamingTableExec │
-19)│ -------------------- │
-20)│ infinite: true │
-21)│ limit: None │
-22)└───────────────────────────┘
+16)│ -------------------- │
+17)│ output_partition_count: │
+18)│ 1 │
+19)│ │
+20)│ partitioning_scheme: │
+21)│ RoundRobinBatch(4) │
+22)└─────────────┬─────────────┘
+23)┌─────────────┴─────────────┐
+24)│ StreamingTableExec │
+25)│ -------------------- │
+26)│ infinite: true │
+27)│ limit: None │
+28)└───────────────────────────┘
# same thing but order by date
query TT
@@ -1277,13 +1438,19 @@ physical_plan
13)└─────────────┬─────────────┘
14)┌─────────────┴─────────────┐
15)│ RepartitionExec │
-16)└─────────────┬─────────────┘
-17)┌─────────────┴─────────────┐
-18)│ StreamingTableExec │
-19)│ -------------------- │
-20)│ infinite: true │
-21)│ limit: None │
-22)└───────────────────────────┘
+16)│ -------------------- │
+17)│ output_partition_count: │
+18)│ 1 │
+19)│ │
+20)│ partitioning_scheme: │
+21)│ RoundRobinBatch(4) │
+22)└─────────────┬─────────────┘
+23)┌─────────────┴─────────────┐
+24)│ StreamingTableExec │
+25)│ -------------------- │
+26)│ infinite: true │
+27)│ limit: None │
+28)└───────────────────────────┘
# same thing but order by ticker
query TT
@@ -1307,13 +1474,19 @@ physical_plan
13)└─────────────┬─────────────┘
14)┌─────────────┴─────────────┐
15)│ RepartitionExec │
-16)└─────────────┬─────────────┘
-17)┌─────────────┴─────────────┐
-18)│ StreamingTableExec │
-19)│ -------------------- │
-20)│ infinite: true │
-21)│ limit: None │
-22)└───────────────────────────┘
+16)│ -------------------- │
+17)│ output_partition_count: │
+18)│ 1 │
+19)│ │
+20)│ partitioning_scheme: │
+21)│ RoundRobinBatch(4) │
+22)└─────────────┬─────────────┘
+23)┌─────────────┴─────────────┐
+24)│ StreamingTableExec │
+25)│ -------------------- │
+26)│ infinite: true │
+27)│ limit: None │
+28)└───────────────────────────┘
# same thing but order by time, date
@@ -1338,13 +1511,19 @@ physical_plan
13)└─────────────┬─────────────┘
14)┌─────────────┴─────────────┐
15)│ RepartitionExec │
-16)└─────────────┬─────────────┘
-17)┌─────────────┴─────────────┐
-18)│ StreamingTableExec │
-19)│ -------------------- │
-20)│ infinite: true │
-21)│ limit: None │
-22)└───────────────────────────┘
+16)│ -------------------- │
+17)│ output_partition_count: │
+18)│ 1 │
+19)│ │
+20)│ partitioning_scheme: │
+21)│ RoundRobinBatch(4) │
+22)└─────────────┬─────────────┘
+23)┌─────────────┴─────────────┐
+24)│ StreamingTableExec │
+25)│ -------------------- │
+26)│ infinite: true │
+27)│ limit: None │
+28)└───────────────────────────┘
@@ -1370,10 +1549,66 @@ physical_plan
12)└─────────────┬─────────────┘
13)┌─────────────┴─────────────┐
14)│ RepartitionExec │
-15)└─────────────┬─────────────┘
-16)┌─────────────┴─────────────┐
-17)│ StreamingTableExec │
-18)│ -------------------- │
-19)│ infinite: true │
-20)│ limit: None │
-21)└───────────────────────────┘
+15)│ -------------------- │
+16)│ output_partition_count: │
+17)│ 1 │
+18)│ │
+19)│ partitioning_scheme: │
+20)│ RoundRobinBatch(4) │
+21)└─────────────┬─────────────┘
+22)┌─────────────┴─────────────┐
+23)│ StreamingTableExec │
+24)│ -------------------- │
+25)│ infinite: true │
+26)│ limit: None │
+27)└───────────────────────────┘
+
+
+
+# Test explain tree for WorkTableExec
+query TT
+EXPLAIN WITH RECURSIVE nodes AS (
+ SELECT 1 as id
+ UNION ALL
+ SELECT id + 1 as id
+ FROM nodes
+ WHERE id < 10
+)
+SELECT * FROM nodes
+----
+physical_plan
+01)┌───────────────────────────┐
+02)│ RecursiveQueryExec ├──────────────┐
+03)└─────────────┬─────────────┘ │
+04)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+05)│ ProjectionExec ││ CoalescePartitionsExec │
+06)│ -------------------- ││ │
+07)│ id: 1 ││ │
+08)└─────────────┬─────────────┘└─────────────┬─────────────┘
+09)┌─────────────┴─────────────┐┌─────────────┴─────────────┐
+10)│ PlaceholderRowExec ││ ProjectionExec │
+11)│ ││ -------------------- │
+12)│ ││ id: id@0 + 1 │
+13)└───────────────────────────┘└─────────────┬─────────────┘
+14)-----------------------------┌─────────────┴─────────────┐
+15)-----------------------------│ CoalesceBatchesExec │
+16)-----------------------------└─────────────┬─────────────┘
+17)-----------------------------┌─────────────┴─────────────┐
+18)-----------------------------│ FilterExec │
+19)-----------------------------│ -------------------- │
+20)-----------------------------│ predicate: id@0 < 10 │
+21)-----------------------------└─────────────┬─────────────┘
+22)-----------------------------┌─────────────┴─────────────┐
+23)-----------------------------│ RepartitionExec │
+24)-----------------------------│ -------------------- │
+25)-----------------------------│ output_partition_count: │
+26)-----------------------------│ 1 │
+27)-----------------------------│ │
+28)-----------------------------│ partitioning_scheme: │
+29)-----------------------------│ RoundRobinBatch(4) │
+30)-----------------------------└─────────────┬─────────────┘
+31)-----------------------------┌─────────────┴─────────────┐
+32)-----------------------------│ WorkTableExec │
+33)-----------------------------│ -------------------- │
+34)-----------------------------│ name: nodes │
+35)-----------------------------└───────────────────────────┘
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]