@Override
    public void reset(AggregationBuffer agg) throws HiveException {
      SumAgg<HiveDecimalWritable> bdAgg = (SumAgg<HiveDecimalWritable>) agg;
      bdAgg.sum = new HiveDecimalWritable(0);
      bdAgg.uniqueObjects = null;
      bdAgg.nonNullCount = 0;
    }
class for storing decimal sum value.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java