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 a176aacc92 implement tree explain for GlobalLimitExec (#15100)
a176aacc92 is described below

commit a176aacc92a5b0272690bb48e7084ff5603ef7ad
Author: zjregee <[email protected]>
AuthorDate: Mon Mar 10 18:52:48 2025 +0800

    implement tree explain for GlobalLimitExec (#15100)
    
    * implement tree explain for global limit exec
    
    * optimize output
---
 datafusion/physical-plan/src/limit.rs               |  6 ++++--
 datafusion/sqllogictest/test_files/explain_tree.slt | 21 +++++++++++++++++++++
 2 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/datafusion/physical-plan/src/limit.rs 
b/datafusion/physical-plan/src/limit.rs
index 71a23d31ff..b9464e3a88 100644
--- a/datafusion/physical-plan/src/limit.rs
+++ b/datafusion/physical-plan/src/limit.rs
@@ -109,8 +109,10 @@ impl DisplayAs for GlobalLimitExec {
                 )
             }
             DisplayFormatType::TreeRender => {
-                // TODO: collect info
-                write!(f, "")
+                if let Some(fetch) = self.fetch {
+                    writeln!(f, "limit={}", fetch)?;
+                }
+                write!(f, "skip={}", self.skip)
             }
         }
     }
diff --git a/datafusion/sqllogictest/test_files/explain_tree.slt 
b/datafusion/sqllogictest/test_files/explain_tree.slt
index f54cbb600a..d81d83ea42 100644
--- a/datafusion/sqllogictest/test_files/explain_tree.slt
+++ b/datafusion/sqllogictest/test_files/explain_tree.slt
@@ -193,6 +193,27 @@ physical_plan
 20)│        format: csv        │
 21)└───────────────────────────┘
 
+# Limit
+query TT
+explain SELECT int_col FROM table1 LIMIT 3,2;
+----
+logical_plan
+01)Limit: skip=3, fetch=2
+02)--TableScan: table1 projection=[int_col], fetch=5
+physical_plan
+01)┌───────────────────────────┐
+02)│      GlobalLimitExec      │
+03)│    --------------------   │
+04)│          limit: 2         │
+05)│          skip: 3          │
+06)└─────────────┬─────────────┘
+07)┌─────────────┴─────────────┐
+08)│       DataSourceExec      │
+09)│    --------------------   │
+10)│          files: 1         │
+11)│        format: csv        │
+12)└───────────────────────────┘
+
 # 2 Joins
 query TT
 explain SELECT table1.string_col, table2.date_col FROM table1 JOIN table2 ON 
table1.int_col = table2.int_col;


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to