fix: preserve approximate percentile arguments with inline ORDER BY - #24411
Open
haohuaijin wants to merge 3 commits into
Open
fix: preserve approximate percentile arguments with inline ORDER BY#24411haohuaijin wants to merge 3 commits into
haohuaijin wants to merge 3 commits into
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24411 +/- ##
==========================================
- Coverage 81.23% 81.23% -0.01%
==========================================
Files 1112 1112
Lines 390635 390630 -5
Branches 390635 390630 -5
==========================================
- Hits 317350 317332 -18
- Misses 54650 54657 +7
- Partials 18635 18641 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Jefffrey
reviewed
Aug 16, 2026
Jefffrey
left a comment
Contributor
There was a problem hiding this comment.
i think this makes sense in keeping existing ordered set aggregates in line with percentile_cont (which doesnt suffer this issue since i think the code was specifically designed for how many arguments it has?)
though @jayzhan211 does have thoughts on how we should handle ORDER BYs with these functions
Contributor
Author
Jefffrey
approved these changes
Aug 16, 2026
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?
Rationale for this change
Inline ORDER BY handling incorrectly removes percentile or weight arguments from approximate percentile aggregates.
What changes are included in this PR?
Only remove the first aggregate argument when it matches the inline ordering expression. Add regression coverage for
approx_percentile_contandapprox_percentile_cont_with_weight.Are these changes tested?
Yes. The aggregate.slt regression tests, ./dev/rust_lint.sh, and cargo clippy --all-targets --all-features -- -D warnings all pass.
Are there any user-facing changes?
Valid approximate percentile queries using inline ORDER BY now plan and execute successfully.