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.42k stars 1.12k forks source link

inverse_beta_cdf: Presto and Velox return different results #10873

Open kagamiori opened 3 weeks ago

kagamiori commented 3 weeks ago

Description

Query: select inverse_beta_cdf(0.0085697465364049, c0, 0.013200567975753) from (values 0.8864628029987216) t(c0); Presto-0.289: Returns 0 Velox: Returns 6.03651352807685E-220

Error Reproduction

No response

Relevant logs

No response

Yuhta commented 3 weeks ago

Difference between these 2 values are well below machine epsilon, why we are not comparing it with delta?

kagamiori commented 3 weeks ago

Difference between these 2 values are well below machine epsilon, why we are not comparing it with delta?

@Yuhta This small difference is magnified when the result of inverse_beta_cdf is called in other functions. E.g.,

Query: select abs(power(ceiling(inverse_beta_cdf(0.0085697465364049, c0, 0.013200567975753)), log2(DOUBLE '0.08720093965530396'))) from (values 0.8864628029987216) t(c0);

Presto-0.289: Returns Infinity Velox: Returns 1.0

Yuhta commented 3 weeks ago

Both solutions look good to me, I don't see anything wrong here