You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by al...@apache.org on 2022/12/10 10:23:37 UTC

[arrow-datafusion] branch master updated: Avoid materializing local varaibles when creating `sortMergeJoinExec` (#4566)

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 2a9009ea4 Avoid materializing local varaibles when creating `sortMergeJoinExec` (#4566)
2a9009ea4 is described below

commit 2a9009ea49e166cd025934a8e970ac18de129671
Author: Remzi Yang <59...@users.noreply.github.com>
AuthorDate: Sat Dec 10 18:23:31 2022 +0800

    Avoid materializing local varaibles when creating `sortMergeJoinExec` (#4566)
    
    * avoid materializing
    
    Signed-off-by: remzi <13...@gmail.com>
    
    * fmt
    
    Signed-off-by: remzi <13...@gmail.com>
    
    Signed-off-by: remzi <13...@gmail.com>
---
 .../src/physical_plan/joins/sort_merge_join.rs     | 36 ++++++++--------------
 1 file changed, 12 insertions(+), 24 deletions(-)

diff --git a/datafusion/core/src/physical_plan/joins/sort_merge_join.rs b/datafusion/core/src/physical_plan/joins/sort_merge_join.rs
index 797f61db6..28df317a8 100644
--- a/datafusion/core/src/physical_plan/joins/sort_merge_join.rs
+++ b/datafusion/core/src/physical_plan/joins/sort_merge_join.rs
@@ -113,33 +113,21 @@ impl SortMergeJoinExec {
             )));
         }
 
-        let (left_expr, right_expr): (Vec<_>, Vec<_>) = on
+        let (left_sort_exprs, right_sort_exprs): (Vec<_>, Vec<_>) = on
             .iter()
-            .map(|(l, r)| {
-                (
-                    Arc::new(l.clone()) as Arc<dyn PhysicalExpr>,
-                    Arc::new(r.clone()) as Arc<dyn PhysicalExpr>,
-                )
-            })
-            .unzip();
-
-        let left_sort_exprs = left_expr
-            .into_iter()
-            .zip(sort_options.iter())
-            .map(|(k, sort_op)| PhysicalSortExpr {
-                expr: k,
-                options: *sort_op,
-            })
-            .collect::<Vec<_>>();
-
-        let right_sort_exprs = right_expr
-            .into_iter()
             .zip(sort_options.iter())
-            .map(|(k, sort_op)| PhysicalSortExpr {
-                expr: k,
-                options: *sort_op,
+            .map(|((l, r), sort_op)| {
+                let left = PhysicalSortExpr {
+                    expr: Arc::new(l.clone()) as Arc<dyn PhysicalExpr>,
+                    options: *sort_op,
+                };
+                let right = PhysicalSortExpr {
+                    expr: Arc::new(r.clone()) as Arc<dyn PhysicalExpr>,
+                    options: *sort_op,
+                };
+                (left, right)
             })
-            .collect::<Vec<_>>();
+            .unzip();
 
         let output_ordering = match join_type {
             JoinType::Inner