Description
As per spec section 4.8.5 Aggregate Functions in the SELECT Clause we need to handle a few types in a special way
SUM returns Long when applied to state fields of integral types (other than BigInteger); Dou- ble when applied to state fields of floating point types; BigInteger when applied to state fields of type BigInteger; and BigDecimal when applied to state fields of type BigDecimal.