aoto-tech opened a new pull request, #25274:
URL: https://github.com/apache/datafusion/pull/25274

   ## Which issue does this PR close?
   
   - Closes #25267.
   
   ## Rationale for this change
   
   `percentile_cont` can return `Infinity` for finite Float64 inputs when 
`upper - lower` overflows, even though the interpolated result is finite. I hit 
this with `[-DBL_MAX, DBL_MAX]` at `0.5`; the median should be `0`.
   
   ## What changes are included in this PR?
   
   I keep the current difference-based formula when the subtraction is finite. 
If both endpoints are finite but their difference overflows, I switch to 
weighting each endpoint separately. That avoids the infinite intermediate 
without changing the existing Float16 or non-finite-input paths.
   
   I also added a direct unit test for the overflow branch with symmetric, 
asymmetric, and quarter-percentile cases, plus an end-to-end SQL test for the 
reported query.
   
   ## What is the testing strategy for this PR?
   
   The new unit test failed with `inf != 0.0` before the fix.
   
   I ran:
   
   - `cargo test --profile ci -p datafusion-functions-aggregate --lib` (233 
passed)
   - the new `aggregate.slt` query through the sqllogictest runner (passed)
   - `cargo clippy --profile ci -p datafusion-functions-aggregate --all-targets 
--all-features --no-deps -- -D warnings`
   - `cargo fmt --all -- --check`
   
   ## Are there any user-facing changes?
   
   Yes. `percentile_cont` now returns a finite result when finite Float64 
endpoints have an overflowing difference but a finite interpolation result. 
There is no API change.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to