@Override
    public void merge(AggregationBuffer agg, Object partial) throws HiveException {
      if (partial != null) {
        SumLongAgg myagg = (SumLongAgg) agg;
        if (isWindowingDistinct()) {
          throw new HiveException("Distinct windowing UDAF doesn't support merge and terminatePartial");
        } else {
            myagg.sum += PrimitiveObjectInspectorUtils.getLong(partial, inputOI);
            myagg.nonNullCount++;
        }
      }
    }
class for storing double sum value.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFSum.java