public Object evaluate(AggregationBuffer agg) throws HiveException {
    if (mode == Mode.PARTIAL1 || mode == Mode.PARTIAL2) {
      return terminatePartial(agg);
    } else {
      return terminate(agg);
    }
  }
This function will be called by GroupByOperator when it sees a new input
row.

@param agg
         The object to store the aggregation result.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFEvaluator.java