@Override
    public Object terminate(AggregationBuffer agg) throws HiveException {
      SumLongAgg myagg = (SumLongAgg) agg;
      if (myagg.nonNullCount == 0) {
        return null;
      }
      result.set(myagg.sum);
      return result;
    }
class for storing double sum value.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java