Apache DataFusion SQL Query Engine
impl fmt::Display for PlanType (#752)
Jiayu Liu93670f58a9e9
diff --git a/datafusion/src/logical_plan/plan.rs b/datafusion/src/logical_plan/plan.rsindex 4749840ed4..42eaf8e559 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.rsindex 3c5ef1af32..c838ce4a94 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)?;}