Skip to content

Apache DataFusion SQL Query Engine

Implement tree explain for `LocalLimitExec` (#15232)

Shruti Sharmae37d5801b450
diff --git a/datafusion/physical-plan/src/limit.rs b/datafusion/physical-plan/src/limit.rs
index b9464e3a88..89cf47a6d6 100644
--- a/datafusion/physical-plan/src/limit.rs
+++ b/datafusion/physical-plan/src/limit.rs
@@ -268,8 +268,7 @@ impl DisplayAs for LocalLimitExec {
write!(f, "LocalLimitExec: fetch={}", self.fetch)
}
DisplayFormatType::TreeRender => {
- // TODO: collect info
- write!(f, "")
+ write!(f, "limit={}", self.fetch)
}
}
}
diff --git a/datafusion/sqllogictest/test_files/explain_tree.slt b/datafusion/sqllogictest/test_files/explain_tree.slt
index 1a1b039658..83d2edee70 100644
--- a/datafusion/sqllogictest/test_files/explain_tree.slt
+++ b/datafusion/sqllogictest/test_files/explain_tree.slt
@@ -133,6 +133,11 @@ AS SELECT
FROM
hashjoin_datatype_table_t2_source
+statement ok
+CREATE TABLE limit_table AS
+SELECT * FROM table1
+UNION ALL SELECT * FROM table1
+
######## Begin Queries ########
# Filter
@@ -246,6 +251,21 @@ physical_plan
11)│ format: csv │
12)└───────────────────────────┘
+query TT
+explain SELECT * FROM limit_table LIMIT 10;
+----
+physical_plan
+01)┌───────────────────────────┐
+02)│ CoalescePartitionsExec │
+03)└─────────────┬─────────────┘
+04)┌─────────────┴─────────────┐
+05)│ DataSourceExec │
+06)│ -------------------- │
+07)│ bytes: 3120 │
+08)│ format: memory │
+09)│ rows: 2 │
+10)└───────────────────────────┘
+
# 2 Joins
query TT
explain SELECT table1.string_col, table2.date_col FROM table1 JOIN table2 ON table1.int_col = table2.int_col;