-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Fix IN expr for NaN #7378
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
Fix IN expr for NaN #7378
Conversation
| let batch = RecordBatch::try_new(Arc::new(schema.clone()), vec![Arc::new(a)])?; | ||
|
|
||
| // expression: "a in (0.0, 0.2)" | ||
| // expression: "a in (0.0, 0.1)" |
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.
Some comments are wrong and it's a tiny issue. So I'll fix them within this PR.
| where | ||
| T: ArrayAccessor, | ||
| T::Item: PartialEq + HashValue, | ||
| T::Item: IsEqual + HashValue, |
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.
ditto
viirya
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.
Can we add end-to-end test for this too?
| ---- | ||
| 1.2 | ||
| NaN | ||
| NaN |
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.
Hmm, shouldn't it be -NaN?
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.
It's actually -NaN but just shown as NaN.
I've already noticed this issue and have plan to fix it, but it's a separate issue.
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.
Okay
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.
Which issue does this PR close?
Closes #7377
Rationale for this change
This PR fixes an issue that
'NaN'::double in ('NaN'::double)is evaluated asfalse, which is inconsistent with the result of'NaN'::double = 'NaN'::double.What changes are included in this PR?
The root cause is that equality is evaluated using
PartialEq::eq. So the fix is usingto_bitsfor equality check for float values like asScalarValue::Float64does.NOTE: This issue doesn't happen when
SimplifiersimplifiesINexpr likeAre these changes tested?
Modified an existing test.
Are there any user-facing changes?
Yes, but this change is for correctness.