Reputation: 363
I am trying to sum up a column of double type in hive. However the result is inconsistent. I am getting value like 136.0021
as output and on rerunning I am getting value as 136.0017
. I can understand that we cant expect precision with double values. But my output is to be saved in hive table where the column is configured as double type.
Is there any approach to resolve this precision issue without updating column data type
Upvotes: 1
Views: 847
Reputation: 363
I cast double values to decimal before performing addition. After addition I then cast result back to double and put it in hdfs.
Upvotes: 0