From f928b2613365c0e025184bc37261e1e5bd59f4cc Mon Sep 17 00:00:00 2001 From: kamille Date: Mon, 11 Sep 2023 09:44:50 +0800 Subject: [PATCH] reduce the locking range in `metrics_to_string`. --- query_engine/src/datafusion_impl/physical_plan.rs | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/query_engine/src/datafusion_impl/physical_plan.rs b/query_engine/src/datafusion_impl/physical_plan.rs index 48b5313b22..672520a986 100644 --- a/query_engine/src/datafusion_impl/physical_plan.rs +++ b/query_engine/src/datafusion_impl/physical_plan.rs @@ -140,12 +140,13 @@ impl PhysicalPlan for DataFusionPhysicalPlanAdapter { } fn metrics_to_string(&self) -> String { - let executed_opt = &*self.executed_plan.read().unwrap(); + let executed_opt = { self.executed_plan.read().unwrap().clone() }; + match executed_opt { Some(plan) => DisplayableExecutionPlan::with_metrics(plan.as_ref()) .indent(true) .to_string(), - None => "Plan is not executed yet".to_string(), + None => "plan is not executed yet".to_string(), } } }