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

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


The following commit(s) were added to refs/heads/main by this push:
     new 2b848778ad avoid unwrap (#8956)
2b848778ad is described below

commit 2b848778adad838ee696485b9b04c55ce1a5fe40
Author: Luv-Ray <[email protected]>
AuthorDate: Wed Jan 24 19:37:59 2024 +0800

    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 2cb59d511c..f53e70ab64 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::<Vec<_>>();
 

Reply via email to