Skip to content
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

Presto Aggregate Max(Nan) yields non Nan value #8690

Open
kgpai opened this issue Feb 7, 2024 · 2 comments
Open

Presto Aggregate Max(Nan) yields non Nan value #8690

kgpai opened this issue Feb 7, 2024 · 2 comments
Assignees
Labels
bug Something isn't working

Comments

@kgpai
Copy link
Contributor

kgpai commented Feb 7, 2024

Bug description

Currently presto aggregate function max seems to ignore NaN . As can be seen from the queries below.

c++ ======================================
presto:feed> select max(x) from (values 4.0,nan(),null) T(x);
   4.0

presto:feed> select max(x) from (values nan(),nan(),null) T(x);
 -1.7976931348623157E308

presto:feed> select min(x) from (values 4.0,nan(),null) T(x);
   NaN

presto:feed> select min(x) from (values nan(),nan(),null) T(x);
   NaN


java =====================================
presto:feed> select max(x) from (values 4.0,nan(),null) T(x);
   4.0

presto:feed> select max(x) from (values nan(),nan(),null) T(x);
   NaN

presto:feed> select min(x) from (values 4.0,nan(),null) T(x);
   4.0

presto:feed> select min(x) from (values nan(),nan(),null) T(x);
   NaN

System information

N/A

Relevant logs

No response

@kgpai kgpai added the bug Something isn't working label Feb 7, 2024
@kgpai kgpai self-assigned this Feb 7, 2024
@mbasmanova
Copy link
Contributor

Notice that in Java, for some reason, the order matters:

presto:di> select max(x) from (values 4.0,nan(),null) T(x);;
 _col0
-------
   4.0
(1 row)

presto:di> select max(x) from (values nan(),4.0,null) T(x);
 _col0
-------
   NaN
(1 row)

This might be a bug in Java. Worth creating an issue in prestodb to ask.

@kgpai
Copy link
Contributor Author

kgpai commented Feb 7, 2024

Created issue here : prestodb/presto#21877 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants