public static boolean isEstimable(AggregationBuffer buffer) {
    if (buffer instanceof AbstractAggregationBuffer) {
      Class<? extends AggregationBuffer> clazz = buffer.getClass();
      AggregationType annotation = AnnotationUtils.getAnnotation(clazz, AggregationType.class);
      return annotation != null && annotation.estimable();
    }
    return false;
  }
A Generic User-defined aggregation function (GenericUDAF) for the use with
Hive.

New GenericUDAF classes need to inherit from this GenericUDAF class.

The GenericUDAF are superior to normal UDAFs in the following ways: 1. It can
accept arguments of complex types, and return complex types. 2. It can accept
variable length of arguments. 3. It can accept an infinite number of function
signature - for example, it's easy to write a GenericUDAF that accepts
array&lt;int&gt;, array&lt;array&lt;int&gt;&gt; and so on (arbitrary levels of nesting).
ql/src/java/org/apache/hadoop/hive/ql/udf/generic/GenericUDAFEvaluator.java