private static AggregationDesc buildAggregationDesc(
      VectorizationContext ctx,
      String aggregate,
      GenericUDAFEvaluator.Mode mode,
      String column,
      TypeInfo typeInfo) {


    TypeInfo[] typeInfos = new TypeInfo[] {typeInfo};
    ArrayList<ExprNodeDesc> params = new ArrayList<ExprNodeDesc>(1);
    ExprNodeDesc inputColumn = buildColumnDesc(ctx, column, typeInfo);
    params.add(inputColumn);

    AggregationDesc agg = new AggregationDesc();
    agg.setGenericUDAFName(aggregate);
    agg.setMode(mode);
    agg.setParameters(params);

    final GenericUDAFEvaluator evaluator;
    try {
      switch (aggregate) {
      case "count":
        evaluator = new GenericUDAFCount.GenericUDAFCountEvaluator();
        break;
      case "min":
        evaluator = new GenericUDAFMin.GenericUDAFMinEvaluator();
        break;
      case "max":
        evaluator = new GenericUDAFMax.GenericUDAFMaxEvaluator();
        break;
      case "sum":
        evaluator = (new GenericUDAFSum()).getEvaluator(typeInfos);
        break;
      case "avg":
        evaluator = (new GenericUDAFAverage()).getEvaluator(typeInfos);
        break;
      case "variance":
      case "var":
      case "var_pop":
        evaluator = new GenericUDAFVariance.GenericUDAFVarianceEvaluator();
        break;
      case "var_samp":
        evaluator = new GenericUDAFVarianceSample.GenericUDAFVarianceSampleEvaluator();
        break;
      case "std":
      case "stddev":
      case "stddev_pop":
        evaluator = new GenericUDAFStd.GenericUDAFStdEvaluator();
        break;
      case "stddev_samp":
        evaluator = new GenericUDAFStdSample.GenericUDAFStdSampleEvaluator();
        break;
      default:
        throw new RuntimeException("Unexpected aggregate " + aggregate);
      }
    } catch (SemanticException e) {
      throw new RuntimeException(e);
    }
    agg.setGenericUDAFEvaluator(evaluator);
    return agg;
  }
Unit test for the vectorized GROUP BY operator.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorGroupByOperator.java