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 2585ae6d76 Minor: reduce redundant code (#6901)
2585ae6d76 is described below

commit 2585ae6d76d9111ed0f4810effb6de9a3aaa1021
Author: jokercurry <[email protected]>
AuthorDate: Mon Jul 10 22:00:01 2023 +0800

    Minor: reduce redundant code (#6901)
    
    * Minor:reduce redundant code
    
    * nit
    
    * nit
    
    ---------
    
    Co-authored-by: zhongjingxiong <[email protected]>
---
 .../src/physical_plan/joins/nested_loop_join.rs    | 40 ++++++++--------------
 1 file changed, 15 insertions(+), 25 deletions(-)

diff --git a/datafusion/core/src/physical_plan/joins/nested_loop_join.rs 
b/datafusion/core/src/physical_plan/joins/nested_loop_join.rs
index d5de88d933..fe7d1a7c69 100644
--- a/datafusion/core/src/physical_plan/joins/nested_loop_join.rs
+++ b/datafusion/core/src/physical_plan/joins/nested_loop_join.rs
@@ -20,12 +20,12 @@
 //! determined by the [`JoinType`].
 
 use crate::physical_plan::joins::utils::{
-    adjust_right_output_partitioning, append_right_indices, 
apply_join_filter_to_indices,
-    build_batch_from_indices, build_join_schema, check_join_is_valid,
-    combine_join_equivalence_properties, estimate_join_statistics, 
get_anti_indices,
-    get_anti_u64_indices, get_final_indices_from_bit_map, get_semi_indices,
-    get_semi_u64_indices, BuildProbeJoinMetrics, ColumnIndex, JoinFilter, 
JoinSide,
-    OnceAsync, OnceFut,
+    append_right_indices, apply_join_filter_to_indices, 
build_batch_from_indices,
+    build_join_schema, check_join_is_valid, 
combine_join_equivalence_properties,
+    estimate_join_statistics, get_anti_indices, get_anti_u64_indices,
+    get_final_indices_from_bit_map, get_semi_indices, get_semi_u64_indices,
+    partitioned_join_output_partitioning, BuildProbeJoinMetrics, ColumnIndex, 
JoinFilter,
+    JoinSide, OnceAsync, OnceFut,
 };
 use crate::physical_plan::metrics::{ExecutionPlanMetricsSet, MetricsSet};
 use crate::physical_plan::{
@@ -149,25 +149,15 @@ impl ExecutionPlan for NestedLoopJoinExec {
 
     fn output_partitioning(&self) -> Partitioning {
         // the partition of output is determined by the rule of 
`required_input_distribution`
-        // TODO we can replace it by `partitioned_join_output_partitioning`
-        match self.join_type {
-            // use the left partition
-            JoinType::Inner
-            | JoinType::Left
-            | JoinType::LeftSemi
-            | JoinType::LeftAnti
-            | JoinType::Full => self.left.output_partitioning(),
-            // use the right partition
-            JoinType::Right => {
-                // if the partition of right is hash,
-                // and the right partition should be adjusted the column index 
for the right expr
-                adjust_right_output_partitioning(
-                    self.right.output_partitioning(),
-                    self.left.schema().fields.len(),
-                )
-            }
-            // use the right partition
-            JoinType::RightSemi | JoinType::RightAnti => 
self.right.output_partitioning(),
+        if self.join_type == JoinType::Full {
+            self.left.output_partitioning()
+        } else {
+            partitioned_join_output_partitioning(
+                self.join_type,
+                self.left.output_partitioning(),
+                self.right.output_partitioning(),
+                self.left.schema().fields.len(),
+            )
         }
     }
 

Reply via email to