@Override
    public void reset(AggregationBuffer agg) throws HiveException {
      NGramAggBuf result = (NGramAggBuf) agg;
      result.nge.reset();
      result.n = 0;
    }
A constant-space heuristic to estimate the top-k n-grams.
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFnGrams.java