Conversation
aoto-tech
marked this pull request as ready for review
September 13, 2026 16:16
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #25275 +/- ##
=======================================
Coverage 81.91% 81.91%
=======================================
Files 1134 1134
Lines 425631 425673 +42
Branches 425631 425673 +42
=======================================
+ Hits 348647 348685 +38
- Misses 56304 56308 +4
Partials 20680 20680 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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?
percentile_conttruncates Float64 interpolation weights to six decimal places #25266.Rationale for this change
For floating-point inputs,
percentile_contcurrently truncates the interpolation weight to six decimal places. A small but nonzero percentile such as2.5e-7therefore returns the lower input value instead of an interpolated result.What changes are included in this PR?
I removed the integer quantization from the float path and apply the
f64interpolation fraction directly. Decimal interpolation still uses the existing fixed precision; I renamed the constant to make that boundary explicit.I also use separately weighted terms when finite endpoints have opposite signs. The usual difference-based form stays in place otherwise, but it would overflow before applying the fraction for a range such as
-f64::MAX..=f64::MAX.What is the testing strategy for this PR?
I added a unit test that exercises the reported sub-millionth weight through
calculate_percentilefor Float16, Float32, and Float64. There is also a focused test for the opposite-extreme overflow path, plus an sqllogictest covering the three float types. Three existing expected values change because they previously included the six-decimal truncation error.I ran:
cargo test --locked -p datafusion-functions-aggregate --lib -j 4(234 passed)cargo test --locked -j 4 --test sqllogictests -- aggregate.sltcargo fmt --all -- --checkI also ran Clippy for all targets in
datafusion-functions-aggregate. With Rust 1.97 I had to allow the pre-existingunnecessary_semicolonwarning indatafusion/common/src/rounding.rs:257; otherwise Clippy stops in that dependency before reaching this crate.Are there any user-facing changes?
Yes.
percentile_contnow preserves the full interpolation weight for floating-point inputs. There is no public API change.