alamb commented on code in PR #15166:
URL: https://github.com/apache/datafusion/pull/15166#discussion_r1993450147


##########
datafusion/core/src/physical_planner.rs:
##########
@@ -1740,18 +1739,62 @@ impl DefaultPhysicalPlanner {
         let mut stringified_plans = vec![];
 
         let config = &session_state.config_options().explain;
-        let explain_format = DisplayFormatType::from_str(&config.format)?;
+        let explain_format = &e.explain_format;
+
+        match explain_format {
+            ExplainFormat::Indent => { /* fall through */ }
+            ExplainFormat::Tree => {
+                // Tree render does not try to explain errors,
+                let physical_plan = self
+                    .create_initial_plan(e.plan.as_ref(), session_state)
+                    .await?;
+
+                let optimized_plan = self.optimize_physical_plan(
+                    physical_plan,
+                    session_state,
+                    |_plan, _optimizer| {},
+                )?;
+
+                stringified_plans.push(
+                    displayable(optimized_plan.as_ref()).to_stringified(
+                        e.verbose,
+                        FinalPhysicalPlan,
+                        DisplayFormatType::TreeRender,
+                    ),

Review Comment:
   That is a good idea -- I will try it



-- 
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.

To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org

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


---------------------------------------------------------------------
To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org
For additional commands, e-mail: github-h...@datafusion.apache.org

Reply via email to