This is an automated email from the ASF dual-hosted git repository.

weijun 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 ce536c9190 Implement tree explain for LazyMemoryExec (#15187)
ce536c9190 is described below

commit ce536c9190f37533bd59754acb8effa6974873e6
Author: zeb <[email protected]>
AuthorDate: Thu Mar 13 17:10:17 2025 +0800

    Implement tree explain for LazyMemoryExec (#15187)
    
    Resolve conflicts
---
 datafusion/physical-plan/src/memory.rs              | 13 +++++++++++--
 datafusion/sqllogictest/test_files/explain_tree.slt | 20 +++++++++++++++++++-
 2 files changed, 30 insertions(+), 3 deletions(-)

diff --git a/datafusion/physical-plan/src/memory.rs 
b/datafusion/physical-plan/src/memory.rs
index ae878fdab3..1bc872a56e 100644
--- a/datafusion/physical-plan/src/memory.rs
+++ b/datafusion/physical-plan/src/memory.rs
@@ -193,8 +193,17 @@ impl DisplayAs for LazyMemoryExec {
                 )
             }
             DisplayFormatType::TreeRender => {
-                // TODO: collect info
-                write!(f, "")
+                //TODO: remove batch_size, add one line per generator
+                writeln!(
+                    f,
+                    "batch_generators={}",
+                    self.batch_generators
+                        .iter()
+                        .map(|g| g.read().to_string())
+                        .collect::<Vec<String>>()
+                        .join(", ")
+                )?;
+                Ok(())
             }
         }
     }
diff --git a/datafusion/sqllogictest/test_files/explain_tree.slt 
b/datafusion/sqllogictest/test_files/explain_tree.slt
index bafc4d559b..e61fbf90cd 100644
--- a/datafusion/sqllogictest/test_files/explain_tree.slt
+++ b/datafusion/sqllogictest/test_files/explain_tree.slt
@@ -725,7 +725,12 @@ physical_plan
 32)└─────────────┬─────────────┘
 33)┌─────────────┴─────────────┐
 34)│       LazyMemoryExec      │
-35)└───────────────────────────┘
+35)│    --------------------   │
+36)│     batch_generators:     │
+37)│ generate_series: start=1, │
+38)│    end=1000, batch_size   │
+39)│           =8192           │
+40)└───────────────────────────┘
 
 query TT
 explain select 
@@ -1641,3 +1646,16 @@ physical_plan
 08)│       format: memory      │
 09)│          rows: 1          │
 10)└───────────────────────────┘
+
+# Test explain tree for LazyMemoryExec
+query TT
+EXPLAIN SELECT * FROM generate_series(1, 100)
+----
+physical_plan
+01)┌───────────────────────────┐
+02)│       LazyMemoryExec      │
+03)│    --------------------   │
+04)│     batch_generators:     │
+05)│ generate_series: start=1, │
+06)│  end=100, batch_size=8192 │
+07)└───────────────────────────┘


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

Reply via email to