-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Remove CoalescePartitions insertion from Joins #15570
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
60155c0
refactor: Catch PartitionMode:Auto in execute explicitly
ctsk 630301c
refactor(hash_join): Move coalesce logic into function
ctsk 6a75748
refactor(hash_join): Move coalesce logic out of collect_left_input
ctsk 0545793
refactor(hash_join): Execute build side earlier
ctsk 0922997
chore(hash_join): Drop unnecessary clippy hint \o/
ctsk 84d5f94
Back out "refactor: Catch PartitionMode:Auto in execute explicitly"
ctsk 197f8c9
Remove CoalescePartitions from CollectLeft-HashJoins
ctsk c29700d
Fix imports
ctsk 460196b
Fix tests
ctsk d5c8314
Check CollectLeft-HJ distribution in execute
ctsk 2b26ed2
Fix repeated execute; propagate execute error
ctsk 3b8e80c
Remove CoalescePartitions from nested_loop_join
ctsk 35eb148
Execute left side earlier in nested_loop_join
ctsk ac1dac2
Remove CoalescePartitions from cross_join
ctsk b2bd6bf
Execute left side earlier in cross_join
ctsk 5717f44
Remove unused import
ctsk 995a95c
Fix docs
ctsk 9f21f69
Remove dead comment
ctsk f661b04
Throw error on unexpected distribution
ctsk File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,7 +25,6 @@ use super::utils::{ | |
BatchTransformer, BuildProbeJoinMetrics, NoopBatchTransformer, OnceAsync, OnceFut, | ||
StatefulStreamResult, | ||
}; | ||
use crate::coalesce_partitions::CoalescePartitionsExec; | ||
use crate::execution_plan::{boundedness_from_children, EmissionType}; | ||
use crate::metrics::{ExecutionPlanMetricsSet, MetricsSet}; | ||
use crate::projection::{ | ||
|
@@ -189,19 +188,11 @@ impl CrossJoinExec { | |
|
||
/// Asynchronously collect the result of the left child | ||
async fn load_left_input( | ||
left: Arc<dyn ExecutionPlan>, | ||
context: Arc<TaskContext>, | ||
stream: SendableRecordBatchStream, | ||
metrics: BuildProbeJoinMetrics, | ||
reservation: MemoryReservation, | ||
) -> Result<JoinLeftData> { | ||
// merge all left parts into a single stream | ||
let left_schema = left.schema(); | ||
let merge = if left.output_partitioning().partition_count() != 1 { | ||
Arc::new(CoalescePartitionsExec::new(left)) | ||
} else { | ||
left | ||
}; | ||
let stream = merge.execute(0, context)?; | ||
let left_schema = stream.schema(); | ||
|
||
// Load all batches and count the rows | ||
let (batches, _metrics, reservation) = stream | ||
|
@@ -291,6 +282,13 @@ impl ExecutionPlan for CrossJoinExec { | |
partition: usize, | ||
context: Arc<TaskContext>, | ||
) -> Result<SendableRecordBatchStream> { | ||
if self.left.output_partitioning().partition_count() != 1 { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. love it |
||
return internal_err!( | ||
"Invalid CrossJoinExec, the output partition count of the left child must be 1,\ | ||
consider using CoalescePartitionsExec or the EnforceDistribution rule" | ||
); | ||
} | ||
|
||
let stream = self.right.execute(partition, Arc::clone(&context))?; | ||
|
||
let join_metrics = BuildProbeJoinMetrics::new(partition, &self.metrics); | ||
|
@@ -303,14 +301,15 @@ impl ExecutionPlan for CrossJoinExec { | |
let enforce_batch_size_in_joins = | ||
context.session_config().enforce_batch_size_in_joins(); | ||
|
||
let left_fut = self.left_fut.once(|| { | ||
load_left_input( | ||
Arc::clone(&self.left), | ||
context, | ||
let left_fut = self.left_fut.try_once(|| { | ||
let left_stream = self.left.execute(0, context)?; | ||
|
||
Ok(load_left_input( | ||
left_stream, | ||
join_metrics.clone(), | ||
reservation, | ||
) | ||
}); | ||
)) | ||
})?; | ||
|
||
if enforce_batch_size_in_joins { | ||
Ok(Box::pin(CrossJoinStream { | ||
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.