@Override
    public Object terminatePartial(AggregationBuffer agg) throws HiveException {
      PercentileAgg percAgg = (PercentileAgg) agg;
      partialResult[0] = percAgg.counts;
      partialResult[1] = percAgg.percentiles;
      partialResult[2] = new BooleanWritable(percAgg.isAscending);

      return partialResult;
    }
A state class to store intermediate aggregation results.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFPercentileCont.java