andygrove commented on a change in pull request #7993:
URL: https://github.com/apache/arrow/pull/7993#discussion_r472583526



##########
File path: rust/datafusion/src/dataframe.rs
##########
@@ -174,4 +174,18 @@ pub trait DataFrame {
 
     /// Return the logical plan represented by this DataFrame.
     fn to_logical_plan(&self) -> LogicalPlan;
+
+    /// Return a DataFrame with the explanation of its plan so far.
+    ///
+    /// ```
+    /// # use datafusion::prelude::*;
+    /// # use datafusion::error::Result;
+    /// # fn main() -> Result<()> {
+    /// let mut ctx = ExecutionContext::new();
+    /// let df = ctx.read_csv("tests/example.csv", CsvReadOptions::new())?;
+    /// let batches = df.limit(100)?.explain(false)?.collect()?;
+    /// # Ok(())
+    /// # }
+    /// ```
+    fn explain(&self, verbose: bool) -> Result<Arc<dyn DataFrame>>;

Review comment:
       So Spark has a couple different things to help people debug. `explain` 
literally prints the query plan(s) to stdout. It is also possible to access the 
underlying logical and physical query plans using `df.queryExecution.plan` or 
`df.queryExecution.executedPlan` for example. We already have `to_logical_plan` 
and I do think that we eventually should expose the physical plan as well, but 
not until we have made a decision on how we're implementing the physical plan 
enum and optimizer (there are JIRAs open for these issues already).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


Reply via email to