From 2b848778adad838ee696485b9b04c55ce1a5fe40 Mon Sep 17 00:00:00 2001 From: Luv-Ray <1357065654@qq.com> Date: Wed, 24 Jan 2024 19:37:59 +0800 Subject: [PATCH] avoid unwrap (#8956) --- datafusion/optimizer/src/optimizer.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/datafusion/optimizer/src/optimizer.rs b/datafusion/optimizer/src/optimizer.rs index 2cb59d511ccf..f53e70ab6489 100644 --- a/datafusion/optimizer/src/optimizer.rs +++ b/datafusion/optimizer/src/optimizer.rs @@ -375,10 +375,10 @@ impl Optimizer { let new_inputs = result .into_iter() - .enumerate() - .map(|(i, o)| match o { + .zip(inputs) + .map(|(new_plan, old_plan)| match new_plan { Some(plan) => plan, - None => (*(inputs.get(i).unwrap())).clone(), + None => old_plan.clone(), }) .collect::>();