How do I make the rounding function of athena match redshift?

25 Views Asked by At

Let's say for e.g I am calculating the average for a list of floating points e.g 405.34.

When I ROUND(avg(list),2) in Redshift - I end up with 0.01 less than if I do this in Athena.

It happens for certain values (after checking the entire value I get for the averaged)

e.g - avg = 15.8448.

Redshift will return 15.84 which is what I expect when rounding to 2dp.

Athena however returns 15.85 (so it essentially rounds to 15.845 and then 15.85)

Any idea how I can get the Athena value to match the Redshift?

testing the values returned for the two and it seems redshift truncates where as Athena rounds up

0

There are 0 best solutions below