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

alamb pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow-datafusion.git


The following commit(s) were added to refs/heads/master by this push:
     new 93670f5  impl fmt::Display for PlanType (#752)
93670f5 is described below

commit 93670f58a9e9de41d40badee554dbbb50911237e
Author: Jiayu Liu <[email protected]>
AuthorDate: Mon Jul 19 21:35:13 2021 +0800

    impl fmt::Display for PlanType (#752)
---
 datafusion/src/logical_plan/plan.rs     | 12 ++++++------
 datafusion/src/physical_plan/explain.rs |  2 +-
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/datafusion/src/logical_plan/plan.rs 
b/datafusion/src/logical_plan/plan.rs
index 4749840..42eaf8e 100644
--- a/datafusion/src/logical_plan/plan.rs
+++ b/datafusion/src/logical_plan/plan.rs
@@ -819,14 +819,14 @@ pub enum PlanType {
     PhysicalPlan,
 }
 
-impl From<&PlanType> for String {
-    fn from(t: &PlanType) -> Self {
-        match t {
-            PlanType::LogicalPlan => "logical_plan".into(),
+impl fmt::Display for PlanType {
+    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
+        match self {
+            PlanType::LogicalPlan => write!(f, "logical_plan"),
             PlanType::OptimizedLogicalPlan { optimizer_name } => {
-                format!("logical_plan after {}", optimizer_name)
+                write!(f, "logical_plan after {}", optimizer_name)
             }
-            PlanType::PhysicalPlan => "physical_plan".into(),
+            PlanType::PhysicalPlan => write!(f, "physical_plan"),
         }
     }
 }
diff --git a/datafusion/src/physical_plan/explain.rs 
b/datafusion/src/physical_plan/explain.rs
index 3c5ef1a..c838ce4 100644
--- a/datafusion/src/physical_plan/explain.rs
+++ b/datafusion/src/physical_plan/explain.rs
@@ -104,7 +104,7 @@ impl ExecutionPlan for ExplainExec {
         let mut plan_builder = 
StringBuilder::new(self.stringified_plans.len());
 
         for p in &self.stringified_plans {
-            type_builder.append_value(&String::from(&p.plan_type))?;
+            type_builder.append_value(&p.plan_type.to_string())?;
             plan_builder.append_value(&*p.plan)?;
         }
 

Reply via email to