-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Handle Nan in ArrayMinMax function and remove a todo. #6922
Conversation
✅ Deploy Preview for meta-velox canceled.
|
This pull request was exported from Phabricator. Differential Revision: D49935894 |
c846800
to
a31f145
Compare
…tor#6922) Summary: Pull Request resolved: facebookincubator#6922 Differential Revision: D49935894
This pull request was exported from Phabricator. Differential Revision: D49935894 |
Thanks for the quick fix. Could you please double check if other similar functions also have the same issue such as |
Summary: Also, re-use input strings for result. Differential Revision: D49935894
a31f145
to
5bd6294
Compare
This pull request was exported from Phabricator. Differential Revision: D49935894 |
Summary: Also, re-use input strings for result. Differential Revision: D49935894
5bd6294
to
5b15d17
Compare
This pull request was exported from Phabricator. Differential Revision: D49935894 |
Summary: Also, re-use input strings for result. Differential Revision: D49935894
5b15d17
to
baef804
Compare
This pull request was exported from Phabricator. Differential Revision: D49935894 |
Will look after this one. |
Summary: Also, re-use input strings for result. Differential Revision: D49935894
baef804
to
9c32781
Compare
This pull request was exported from Phabricator. Differential Revision: D49935894 |
Summary: Pull Request resolved: facebookincubator#6922 Differential Revision: D49935894
9c32781
to
4ced2ff
Compare
This pull request was exported from Phabricator. Differential Revision: D49935894 |
|
||
.. function:: array_min(array(E)) -> E | ||
|
||
Returns the minimum value of input array. :: | ||
Returns minimum non-NULL element of the array. Returns NULL if array is empty or contains a NULL element. | ||
When E is DOUBLE or REAL, NaN value is considered greater than any non-NaN value. :: |
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.
Returns NULL if array is empty or contains a NULL element.
NaN value is considered greater than any non-NaN value.
This doesn't seem to hold true completely.
NaN seems to always be returned in both min_by and max_by even if NULL exists which also means its simultaneously considered both highest and lowest value.
Tried these on presto java:
SELECT array_max(ARRAY [nan(), 1.0]); => NaN
SELECT array_max(ARRAY [NULL, nan(), 1.0]); => NaN
SELECT array_min(ARRAY [nan(), 1.0]); => NaN
SELECT array_min(ARRAY [NULL, nan(), 1.0]); => 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.
Good catch @bikramSingh91. In Presto, in presence of a NAN, the result is always NAN regardless of the other elements in the array for both min/max functions.
Differential Revision: D49935894