Fix averages of decimals, and division and mod returning null

BigDecimal cannot represent NaN in Java or in Hive, so Hive returns null
on division and modulus by 0.
More decimal tests
Optimize sums and averages on fixed-precision Decimals