Skip to content
Open
Show file tree
Hide file tree
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
9 changes: 5 additions & 4 deletions datafusion/physical-plan/src/joins/cross_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ use super::utils::{
OnceAsync, OnceFut, StatefulStreamResult, adjust_right_output_partitioning,
reorder_output_after_swap,
};
use crate::coop::cooperative;
use crate::execution_plan::{EmissionType, boundedness_from_children};
use crate::metrics::{ExecutionPlanMetricsSet, MetricsSet};
use crate::projection::{
Expand Down Expand Up @@ -332,7 +333,7 @@ impl ExecutionPlan for CrossJoinExec {
})?;

if enforce_batch_size_in_joins {
Ok(Box::pin(CrossJoinStream {
Ok(Box::pin(cooperative(CrossJoinStream {
schema: Arc::clone(&self.schema),
left_fut,
right: stream,
Expand All @@ -341,9 +342,9 @@ impl ExecutionPlan for CrossJoinExec {
state: CrossJoinStreamState::WaitBuildSide,
left_data: RecordBatch::new_empty(self.left().schema()),
batch_transformer: BatchSplitter::new(batch_size),
}))
})))
} else {
Ok(Box::pin(CrossJoinStream {
Ok(Box::pin(cooperative(CrossJoinStream {
schema: Arc::clone(&self.schema),
left_fut,
right: stream,
Expand All @@ -352,7 +353,7 @@ impl ExecutionPlan for CrossJoinExec {
state: CrossJoinStreamState::WaitBuildSide,
left_data: RecordBatch::new_empty(self.left().schema()),
batch_transformer: NoopBatchTransformer::new(),
}))
})))
}
}

Expand Down
5 changes: 3 additions & 2 deletions datafusion/physical-plan/src/joins/hash_join/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ use std::sync::{Arc, OnceLock};
use std::{any::Any, vec};

use crate::ExecutionPlanProperties;
use crate::coop::cooperative;
use crate::execution_plan::{EmissionType, boundedness_from_children};
use crate::filter_pushdown::{
ChildPushdownResult, FilterDescription, FilterPushdownPhase,
Expand Down Expand Up @@ -1169,7 +1170,7 @@ impl ExecutionPlan for HashJoinExec {
.map(|(_, right_expr)| Arc::clone(right_expr))
.collect::<Vec<_>>();

Ok(Box::pin(HashJoinStream::new(
Ok(Box::pin(cooperative(HashJoinStream::new(
partition,
self.schema(),
on_right,
Expand All @@ -1187,7 +1188,7 @@ impl ExecutionPlan for HashJoinExec {
self.right.output_ordering().is_some(),
build_accumulator,
self.mode,
)))
))))
}

fn metrics(&self) -> Option<MetricsSet> {
Expand Down
5 changes: 3 additions & 2 deletions datafusion/physical-plan/src/joins/nested_loop_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ use super::utils::{
reorder_output_after_swap, swap_join_projection,
};
use crate::common::can_project;
use crate::coop::cooperative;
use crate::execution_plan::{EmissionType, boundedness_from_children};
use crate::joins::SharedBitmapBuilder;
use crate::joins::utils::{
Expand Down Expand Up @@ -529,7 +530,7 @@ impl ExecutionPlan for NestedLoopJoinExec {
None => self.column_indices.clone(),
};

Ok(Box::pin(NestedLoopJoinStream::new(
Ok(Box::pin(cooperative(NestedLoopJoinStream::new(
self.schema(),
self.filter.clone(),
self.join_type,
Expand All @@ -538,7 +539,7 @@ impl ExecutionPlan for NestedLoopJoinExec {
column_indices_after_projection,
metrics,
batch_size,
)))
))))
}

fn metrics(&self) -> Option<MetricsSet> {
Expand Down
5 changes: 3 additions & 2 deletions datafusion/physical-plan/src/joins/sort_merge_join/exec.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ use std::any::Any;
use std::fmt::Formatter;
use std::sync::Arc;

use crate::coop::cooperative;
use crate::execution_plan::{EmissionType, boundedness_from_children};
use crate::expressions::PhysicalSortExpr;
use crate::joins::sort_merge_join::metrics::SortMergeJoinMetrics;
Expand Down Expand Up @@ -497,7 +498,7 @@ impl ExecutionPlan for SortMergeJoinExec {
.register(context.memory_pool());

// create join stream
Ok(Box::pin(SortMergeJoinStream::try_new(
Ok(Box::pin(cooperative(SortMergeJoinStream::try_new(
context.session_config().spill_compression(),
Arc::clone(&self.schema),
self.sort_options.clone(),
Expand All @@ -512,7 +513,7 @@ impl ExecutionPlan for SortMergeJoinExec {
SortMergeJoinMetrics::new(partition, &self.metrics),
reservation,
context.runtime_env(),
)?))
)?)))
}

fn metrics(&self) -> Option<MetricsSet> {
Expand Down
9 changes: 5 additions & 4 deletions datafusion/physical-plan/src/joins/symmetric_hash_join.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ use std::task::{Context, Poll};
use std::vec;

use crate::common::SharedMemoryReservation;
use crate::coop::cooperative;
use crate::execution_plan::{boundedness_from_children, emission_type_from_children};
use crate::joins::stream_join_utils::{
PruningJoinHashMap, SortedFilterExpr, StreamJoinMetrics,
Expand Down Expand Up @@ -534,7 +535,7 @@ impl ExecutionPlan for SymmetricHashJoinExec {
}

if enforce_batch_size_in_joins {
Ok(Box::pin(SymmetricHashJoinStream {
Ok(Box::pin(cooperative(SymmetricHashJoinStream {
left_stream,
right_stream,
schema: self.schema(),
Expand All @@ -552,9 +553,9 @@ impl ExecutionPlan for SymmetricHashJoinExec {
state: SHJStreamState::PullRight,
reservation,
batch_transformer: BatchSplitter::new(batch_size),
}))
})))
} else {
Ok(Box::pin(SymmetricHashJoinStream {
Ok(Box::pin(cooperative(SymmetricHashJoinStream {
left_stream,
right_stream,
schema: self.schema(),
Expand All @@ -572,7 +573,7 @@ impl ExecutionPlan for SymmetricHashJoinExec {
state: SHJStreamState::PullRight,
reservation,
batch_transformer: NoopBatchTransformer::new(),
}))
})))
}
}

Expand Down