Repository navigation
Conversation
- window_agg_exec.rs: rebuild with self.can_repartition instead of true, as BoundedWindowAggExec does, so a window planned with target_partitions = 1 keeps requiring a single partition - window.slt: add the query from apache#26626 as a regression test
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.
Which issue does this PR close?
target_partitions = 1(WindowAggExeclosescan_repartitionwhen its children are replaced) #26626.Rationale for this change
With
datafusion.execution.target_partitions = 1, a query with two window functions over an input with more than one partition fails to plan with aSanityCheckPlandistribution error, while the same query runs withtarget_partitions = 4:target_partitionsis a parallelism setting, so it should not decide whether a valid query plans.The planner builds
WindowAggExecwithcan_repartition = falsewhentarget_partitions == 1, so the window requires a single partition.WindowAggExec::replace_childrenwithChildrenPropertiesMode::Recompute(used bywith_new_children) rebuilt the node withcan_repartition = true. After sort enforcement replaced its children, the window requiredKeyPartitioned, theCoalescePartitionsExecbelow it was no longer needed, and the sanity check rejected the plan.What changes are included in this PR?
WindowAggExec::replace_childrenpassesself.can_repartitioninstead oftrue, asBoundedWindowAggExec::replace_childrenalready does.What is the testing strategy for this PR?
window.slt, in the existing section that runs withtarget_partitions = 1, using the query from the issue. It fails without the change with theSanityCheckPlanerror from the issue and returns the expected two rows with it.cargo fmt,cargo clippy -p datafusion-physical-plan --all-targets --all-features -D warnings,cargo test -p datafusion-physical-plan, and thewindow.sltsqllogictests.The fallback in
enforce_sortingthat rebuilds a window with!partition_by().is_empty()also does not carry overcan_repartition. I tried a few other window query shapes withtarget_partitions = 1and none of them failed, so this PR leaves it unchanged.Are there any user-facing changes?
Queries like the one above now plan and run with
target_partitions = 1. No API changes.