facebookincubator / velox

A C++ vectorized database acceleration library aimed to optimizing query engines and data processing systems.
https://velox-lib.io/
Apache License 2.0
3.44k stars 1.12k forks source link

covar_pop returns -Infinity result for INFINITY input #10627

Open kewang1024 opened 1 month ago

kewang1024 commented 1 month ago

Bug description

create TABLE test_ke (name varchar, score double, score2 double, ds varchar) WITH (partitioned_by = ARRAY['ds'] );

INSERT INTO test_ke VALUES ('a', 1.1, 2.0, '2023-05-01'), ('a', INFINITY(), 1.0, '2023-05-01'),

select covar_pop(score, score2) FROM test_ke group by name;

[Presto java result] NaN

[DuckDB result] NaN

[Presto c++ result] -Infinity

System information

NA

Relevant logs

No response

Yuhta commented 1 month ago

I would say our result is more correct in this case (just replace INFINITY() with a huge number to see why). No one should depend on such result though, if it is easy to fix we can change it to make it consistent, otherwise we can just leave it as it is.

kagamiori commented 1 month ago

@Yuhta Should we make Presto-Java match Velox then in this case? Since if Presto and Velox do not match, the fuzzer will just fail.

Yuhta commented 1 month ago

@kagamiori That would be ideal if we could