-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Closed
Labels
bugSomething isn't workingSomething isn't working
Description
Describe the bug
The clamp function in the TDigest doesn't check lo <= hi, which makes it possible to use this function wrongly.
https://github.com/apache/arrow-datafusion/blob/4ec559d1db46afe0ff55eb215b128ab91ac783aa/datafusion/physical-expr/src/aggregate/tdigest.rs#L222-L230
To Reproduce
Steps to reproduce the behavior:
- add the assertion:
fn clamp(v: f64, lo: f64, hi: f64) -> f64 {
assert!(lo <= hi);
if v > hi {
hi
} else if v < lo {
lo
} else {
v
}
}- run
cargo test --alland you will get the failure message:
[aggregate.slt] Running query: "SELECT approx_median(a) FROM median_f64_nan"
thread 'main' panicked at 'assertion failed: lo <= hi', datafusion/physical-expr/src/aggregate/tdigest.rs:223:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace
error: test failed, to rerun pass `-p datafusion --test sqllogictests`
Expected behavior
Additional context
Add any other context about the problem here.
Find in #4653
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't working