-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Move source repartitioning into ExecutionPlan::repartition
#7936
Merged
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
c8e184a
Move source repartitioning into ExecutionPlan::repartition
alamb 86f3015
cleanup
alamb bd9d261
update test
alamb bdc8834
update test
alamb bee0ba5
refine docs
alamb ef30b3d
Merge remote-tracking branch 'apache/main' into alamb/repartition_source
alamb 9dab596
fix merge
alamb 34a0d29
Merge remote-tracking branch 'apache/main' into alamb/repartition_source
alamb 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 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 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 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 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 |
---|---|---|
|
@@ -26,9 +26,6 @@ use std::fmt::Formatter; | |
use std::sync::Arc; | ||
|
||
use crate::config::ConfigOptions; | ||
use crate::datasource::physical_plan::CsvExec; | ||
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. Now enforce distribution is not dependent on the specific operators 🎉 |
||
#[cfg(feature = "parquet")] | ||
use crate::datasource::physical_plan::ParquetExec; | ||
use crate::error::Result; | ||
use crate::physical_optimizer::utils::{ | ||
add_sort_above, get_children_exectrees, get_plan_string, is_coalesce_partitions, | ||
|
@@ -1188,7 +1185,6 @@ fn ensure_distribution( | |
// When `false`, round robin repartition will not be added to increase parallelism | ||
let enable_round_robin = config.optimizer.enable_round_robin_repartition; | ||
let repartition_file_scans = config.optimizer.repartition_file_scans; | ||
let repartition_file_min_size = config.optimizer.repartition_file_min_size; | ||
let batch_size = config.execution.batch_size; | ||
let is_unbounded = unbounded_output(&dist_context.plan); | ||
// Use order preserving variants either of the conditions true | ||
|
@@ -1265,25 +1261,13 @@ fn ensure_distribution( | |
// Unless partitioning doesn't increase the partition count, it is not beneficial: | ||
&& child.output_partitioning().partition_count() < target_partitions | ||
{ | ||
// When `repartition_file_scans` is set, leverage source operators | ||
// (`ParquetExec`, `CsvExec` etc.) to increase parallelism at the source. | ||
// When `repartition_file_scans` is set, attempt to increase | ||
// parallelism at the source. | ||
if repartition_file_scans { | ||
#[cfg(feature = "parquet")] | ||
if let Some(parquet_exec) = | ||
child.as_any().downcast_ref::<ParquetExec>() | ||
if let Some(new_child) = | ||
child.repartitioned(target_partitions, config)? | ||
{ | ||
child = Arc::new(parquet_exec.get_repartitioned( | ||
target_partitions, | ||
repartition_file_min_size, | ||
)); | ||
} | ||
if let Some(csv_exec) = child.as_any().downcast_ref::<CsvExec>() { | ||
if let Some(csv_exec) = csv_exec.get_repartitioned( | ||
target_partitions, | ||
repartition_file_min_size, | ||
) { | ||
child = Arc::new(csv_exec); | ||
} | ||
child = new_child; | ||
} | ||
} | ||
// Increase parallelism by adding round-robin repartitioning | ||
|
@@ -1644,8 +1628,8 @@ mod tests { | |
use crate::datasource::file_format::file_compression_type::FileCompressionType; | ||
use crate::datasource::listing::PartitionedFile; | ||
use crate::datasource::object_store::ObjectStoreUrl; | ||
use crate::datasource::physical_plan::FileScanConfig; | ||
use crate::datasource::physical_plan::ParquetExec; | ||
use crate::datasource::physical_plan::{CsvExec, FileScanConfig}; | ||
use crate::physical_optimizer::enforce_sorting::EnforceSorting; | ||
use crate::physical_optimizer::output_requirements::OutputRequirements; | ||
use crate::physical_plan::aggregates::{ | ||
|
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This just was moved into the
impl ExecutionPlan
and the signature is changed