Hi, With HIVE-5872 the intermediate sum field for decimal aggregates was changed to increase scale by 4. I understand the reasoning for having accurate precision/scale for the aggregate output. However, for the intermediate sum field of AVG, I believe we should increase precision w/o increasing scale. The sum can grow large, but cannot increase digits in the fractional part, so we should increase the precision of the sum, but not the scale. When sum is divided by count to get the average on the reduce side then we should indeed project value with higher scale.
Opinions? Thanks, ~Remus