Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 15 additions & 25 deletions datafusion/core/src/physical_plan/joins/nested_loop_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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::{
Expand Down Expand Up @@ -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(),
)
}
}

Expand Down