Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Fixed
-
Impala 1.4
-
None
Description
Computing Average on a set of decimal results is not correct.
mysql:
mysql> select sum(float_col_4) from table_1; +-----------------------+ | sum(float_col_4) | +-----------------------+ | 319391280635.61476055 | +-----------------------+ 1 row in set (0.00 sec) mysql> select avg(float_col_4) from table_1; +-----------------------+ | avg(float_col_4) | +-----------------------+ | 31939128.063561476055 | +-----------------------+ 1 row in set (0.00 sec)
impala:
[localhost:21000] > select sum(float_col_4) from table_1; Query: select sum(float_col_4) from table_1 +-----------------------+ | sum(float_col_4) | +-----------------------+ | 319391280635.61476055 | +-----------------------+ Returned 1 row(s) in 0.55s [localhost:21000] > select avg(float_col_4) from table_1; Query: select avg(float_col_4) from table_1 +--------------------------------------+ | avg(float_col_4) | +--------------------------------------+ | -47414.42700673951055721309858621187 | +--------------------------------------+ Returned 1 row(s) in 0.56s
Division returns the right scale and precision (there is a unit test to confirm this), so I'm not sure what's going on.