-
Notifications
You must be signed in to change notification settings - Fork 1.3k
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
Add isnan and iszero #7274
Add isnan and iszero #7274
Changes from 2 commits
944f6b6
0e18b21
e5a986b
ba1b83b
6148c56
4b342e1
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -811,6 +811,18 @@ scalar_expr!(CurrentDate, current_date, ,"returns current UTC date as a [`DataTy | |
scalar_expr!(Now, now, ,"returns current timestamp in nanoseconds, using the same value for all instances of now() in same statement"); | ||
scalar_expr!(CurrentTime, current_time, , "returns current UTC time as a [`DataType::Time64`] value"); | ||
scalar_expr!(Nanvl, nanvl, x y, "returns x if x is not NaN otherwise returns y"); | ||
scalar_expr!( | ||
Isnan, | ||
isnan, | ||
num, | ||
"returns true if a given number is +NaN or -NaN otherwise returns false" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. i didn't know there are There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Any value with an exponent field of all 1s is a Nan, and so there are 2^N distinct values of Within arrow-rs we follow the IEEE 754 total order predicate which establishes an ordering for NaNs, (and infinity, etc...) |
||
); | ||
scalar_expr!( | ||
Iszero, | ||
iszero, | ||
num, | ||
"returns true if a given number is +0.0 or -0.0 otherwise returns false" | ||
); | ||
|
||
scalar_expr!(ArrowTypeof, arrow_typeof, val, "data type"); | ||
|
||
|
@@ -1003,6 +1015,8 @@ mod test { | |
test_unary_scalar_expr!(Ln, ln); | ||
test_scalar_expr!(Atan2, atan2, y, x); | ||
test_scalar_expr!(Nanvl, nanvl, x, y); | ||
test_scalar_expr!(Isnan, isnan, input); | ||
test_scalar_expr!(Iszero, iszero, input); | ||
|
||
test_scalar_expr!(Ascii, ascii, input); | ||
test_scalar_expr!(BitLength, bit_length, string); | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
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 would consider
Isnan
andIszero
not math expressions as listed here. The reason to give f64 high priority is also not applied too for these two expressions, I think.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.
Based on above reason, maybe it is less confused to have them in a separate pattern.
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.
Sorry for the late reply.
Yes, f64 doesn't need high priority.
I've changed it.