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

Correctness issue for predicate pushdown on approx numeric column in Postgres #21922

Open
Praveen2112 opened this issue May 10, 2024 · 0 comments · May be fixed by #21923
Open

Correctness issue for predicate pushdown on approx numeric column in Postgres #21922

Praveen2112 opened this issue May 10, 2024 · 0 comments · May be fixed by #21923
Assignees
Labels
bug Something isn't working correctness

Comments

@Praveen2112
Copy link
Member

PostgreSQL treats NaN values as equal, and greater than all non- NaN values which is different from how Trino treats NaN. So if the underlying PG tables has NaN as a part of its data - the comparison operator i.e > 1 or > Infinity() which is pushed down via TupleDomain and ConnectorExpression returns invalid result.

trino:public> set session allow_pushdown_into_connectors=true;
SET SESSION
trino:public> select * from temp2 where c_real > REAL 'Infinity';
c_int | c_real | c_double
-------+--------+----------
1 | NaN | NaN
(1 row)

Query 20240510_124319_00043_pnw65, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0.23 [1 rows, 0B] [4 rows/s, 0B/s]

trino:public> set session allow_pushdown_into_connectors=false;
SET SESSION
trino:public> select * from temp2 where c_real > REAL 'Infinity';
c_int | c_real | c_double
-------+--------+----------
(0 rows)

Query 20240510_124323_00045_pnw65, FINISHED, 1 node
Splits: 1 total, 1 done (100.00%)
0.06 [3 rows, 0B] [47 rows/s, 0B/s]

@Praveen2112 Praveen2112 self-assigned this May 10, 2024
@findepi findepi added the bug Something isn't working label May 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working correctness
Development

Successfully merging a pull request may close this issue.

2 participants