physical_optimizer: preserve_file_partitions when num file groups < target_partitions#21533
Open
jayshrivastava wants to merge 2 commits intoapache:mainfrom
Open
physical_optimizer: preserve_file_partitions when num file groups < target_partitions#21533jayshrivastava wants to merge 2 commits intoapache:mainfrom
jayshrivastava wants to merge 2 commits intoapache:mainfrom
Conversation
…arget_partitions
`datafusion.optimizer.preserve_file_partitions` would not actually preserve the file partitions when the number of file groups is less than the target_partitions. This is unexpected behavior. If a user wants to preserve file partitions, it is because they want to avoid repartitions.
This change fixes that by updating 1 line in the `enforce_distribution` optimizer rule. It also adds a regression test.
Before
```
ProjectionExec
AggregateExec: mode=FinalPartitioned, gby=[f_dkey, timestamp]
RepartitionExec: partitioning=Hash([f_dkey, timestamp], 4), input_partitions=3
AggregateExec: mode=Partial, gby=[f_dkey, timestamp]
DataSourceExec: file_groups=3, projection=[timestamp, value, f_dkey]
```
After
```
ProjectionExec
AggregateExec: mode=SinglePartitioned, gby=[f_dkey, timestamp]
DataSourceExec: file_groups=3, projection=[timestamp, value, f_dkey]
```
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Rationale for this change
datafusion.optimizer.preserve_file_partitionswould not actually preserve the file partitions when the number of file groups is less than the target_partitions. This is unexpected behavior. If a user wants to preserve file partitions, it is because they want to avoid repartitions.Before
After
What changes are included in this PR?
This change fixes that by updating 1 line in the
enforce_distributionoptimizer rule.Are these changes tested?
Yes. In the
preserve_file_partitionsSLT.Are there any user-facing changes?
No.