public static <T extends GenericUDAFEvaluator> List<T> extractEvaluators(
      Collection<? extends AggregationDesc> aggregations, Class<T> clazz) {
    List<T> result = new ArrayList<>();
    for (AggregationDesc d : aggregations) {
      if (clazz.isInstance(d.getGenericUDAFEvaluator())) {
        @SuppressWarnings("unchecked")
        T t = (T) d.getGenericUDAFEvaluator();
        result.add(t);
      }
    }
    return result;
  }
Extracts the UDAFE evaluators of the specified class from the provided aggregations.
ql/src/java/org/apache/hadoop/hive/ql/exec/FunctionUtils.java