Repository navigation
Conversation
Signed-off-by: 1fanwang <1fannnw@gmail.com>
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.
Important
Fork CI setup: For pull requests from a fork to
main, enable workflows in your fork's Actions tab before you push.See the fork CI setup guide.
Which issue does this PR close?
target_partitions = 1(WindowAggExeclosescan_repartitionwhen its children are replaced) #26626.Rationale for this change
A query with two window functions fails to plan when target_partitions is 1, although it runs with 4. Replacing a window's input silently enables repartitioning, so later optimizer passes remove the coalesce the query needs.
What changes are included in this PR?
Preserve can_repartition when rebuilding WindowAggExec, as BoundedWindowAggExec already does.
What is the testing strategy for this PR?
The window.slt regression runs the reported query with target_partitions of 1 and 4, then with window repartitioning disabled.
Before the fix, this command failed:
cargo test --profile ci --test sqllogictests -- test_files/window.slt:8226The same regression and the complete window.slt file pass after the fix:
CARGO_BUILD_JOBS=6 cargo test --profile ci --test sqllogictests -- test_files/window.sltThe reported query also succeeds through the CLI:
CARGO_BUILD_JOBS=6 cargo run --profile ci -p datafusion-cli -- --format csv -c 'SET datafusion.execution.target_partitions = 1; SELECT count(*) OVER (PARTITION BY a + NULL) AS x, count(*) OVER (PARTITION BY a) AS y FROM (SELECT 1 AS a UNION ALL SELECT 2);'The required extended workspace tests passed:
RUST_BACKTRACE=1 CARGO_BUILD_JOBS=6 cargo test --profile ci \ --exclude datafusion-examples --exclude datafusion-benchmarks --exclude datafusion-cli \ --workspace --lib --tests --bins \ --features avro,json,backtrace,extended_tests,recursive_protection,parquet_encryptionFormatting and workspace Clippy passed:
Are there any user-facing changes?
The query returns the expected two rows instead of a planning error. There are no public API changes.