Repository navigation
fix: preserve constant equivalence properties through projection - #27123
Merged
alamb merged 6 commits intoNov 6, 2026
Merged
Conversation
alamb
approved these changes
Nov 5, 2026
alamb
left a comment
Contributor
There was a problem hiding this comment.
Thank you @kumarUjjawal -- this looks correct, and a nice minimal fix to me
I pushed a commit to tweak a comment and will merge. Thank you again
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 5, 2026
github-merge-queue
Bot
removed this pull request from the merge queue due to failed status checks
Nov 5, 2026
With batch_size = 10 the 100 input rows are spread across 4 partitions, and the partial states are merged in whichever order the partitions finish, so the two differing percentiles can be reported as either "0.5 and 0.9" or "0.9 and 0.5". Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Contributor
|
Updated test to get a passinc CI |
28 of 53 tasks
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?
Closes #26624.
Rationale for this change
With
prefer_hash_join = false, a query can fail physical plan validation when a filter makes a computed sort or join key constant. Embedding a projection into the sort-merge join loses the constant property after sorting has already relied on it.What changes are included in this PR?
Preserve each projected equivalence class's constant metadata. A projected member has the same value as its source member on every row, and projection keeps rows in the same partitions. Its known value and uniform or partition-local status therefore still hold. Outer joins clear constants on the NULL-padded side before projecting their output. Partition merges clear
Heterogeneousconstants.Also preserve scalar-subquery leaves during indirect projection. They read a shared subquery result without depending on the input schema. The arithmetic
ORDER BYreproduction needs the metadata copy; the scalar-subquery join reproduction needs both changes.What is the testing strategy for this PR?
SQL cases in
joins.sltcover arithmetic,upper(), left joins, and the scalar-subquery join. A NULL-padded left join checks that matched values sort before the NULL rows. The metadata unit test covers known, unknown, and partition-local constants, dropped arguments, and partition merging.The original SQL cases and metadata test fail before the fix and pass afterward. Validation includes the extended workspace tests, full lint suite, and strict all-features Clippy.
Are there any user-facing changes?
Affected queries plan and execute successfully. No public API changes.
Needs a backport to
branch-56for the 56.0.0 regression tracker (#24461).