-
Notifications
You must be signed in to change notification settings - Fork 1.8k
fix: fix panic when lo is greater than hi #19099
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
2d85ace to
723e035
Compare
|
|
||
| use datafusion_common::instant::Instant; | ||
| use object_store::{path::Path, ObjectMeta}; | ||
| use object_store::{ObjectMeta, path::Path}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is unrelated, but was causing the cargo fmt CI job to fail.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 @adriangb seems to have fixed this in the recent commit to main
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems reasonable to me -- thank you @tshauck
|
|
||
| use datafusion_common::instant::Instant; | ||
| use object_store::{path::Path, ObjectMeta}; | ||
| use object_store::{ObjectMeta, path::Path}; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 @adriangb seems to have fixed this in the recent commit to main
723e035 to
f4b0e2c
Compare
| } | ||
|
|
||
| #[test] | ||
| fn test_identical_values_floating_point_precision() { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I ran this test on my (mac) without the code change I verified it fails
thread 'tdigest::tests::test_identical_values_floating_point_precision' (9627513) panicked at /Users/andrewlamb/.rustup/toolchains/1.91.0-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/num/f64.rs:1413:9:
min > max, or either was NaN. min = 15.699999988079075, max = 15.699999988079073
stack backtrace:
I also double checked the original query it is good now:
DataFusion CLI v51.0.0
> select approx_percentile_cont(0.99) within group (order by value) from (select 15.699999988079073 as value from generate_series(1,215));
+---------------------------------------------------------------------------+
| approx_percentile_cont(Float64(0.99)) WITHIN GROUP [value ASC NULLS LAST] |
+---------------------------------------------------------------------------+
| 15.699999988079075 |
+---------------------------------------------------------------------------+
1 row(s) fetched.
Elapsed 0.035 seconds.
alamb
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks again @tshauck -- very nice work
Which issue does this PR close?
Rationale for this change
It's possible w/ floating point issues that lo could be greater than hi, causing a panic in clamp.
What changes are included in this PR?
Add a check in clamp that reorders the clamp parameters if they're not in order.
Are these changes tested?
Adds a regression test.
Are there any user-facing changes?
No