oap-project / gazelle_plugin

Native SQL Engine plugin for Spark SQL with vectorized SIMD optimizations.
Apache License 2.0
256 stars 77 forks source link

rounding problem with round func #1213

Open jackylee-ch opened 1 year ago

jackylee-ch commented 1 year ago

Describe the bug round(0.0157345, 6) return 0.015734

zhouyuan commented 1 year ago

may due to the float type precision issue

ccat3z commented 1 year ago

Spark round float/double by converting to BigDecimal, maybe we can copy the convert logic of double and decimal in java.

https://github.com/apache/spark/blob/a056f694386cc074219914debf7023f5935bc37d/sql/catalyst/src/main/scala/org/apache/spark/sql/catalyst/expressions/mathExpressions.scala#L1564