private static Pair<GroupByDesc,VectorGroupByDesc> buildKeyGroupByDesc(
      VectorizationContext ctx,
      String aggregate,
      String column,
      TypeInfo dataTypeInfo,
      String[] keys,
      TypeInfo[] keyTypeInfos) {

    Pair<GroupByDesc,VectorGroupByDesc> pair =
        buildGroupByDescType(ctx, aggregate, GenericUDAFEvaluator.Mode.PARTIAL1, column, dataTypeInfo);
    GroupByDesc desc = pair.left;
    VectorGroupByDesc vectorDesc = pair.right;
    vectorDesc.setProcessingMode(ProcessingMode.HASH);

    ArrayList<ExprNodeDesc> keyExprs = new ArrayList<ExprNodeDesc>(keys.length);
    for (int i = 0; i < keys.length; i++) {
      final String key = keys[i];
      final TypeInfo keyTypeInfo = keyTypeInfos[i];
      final ExprNodeDesc keyExp = buildColumnDesc(ctx, key, keyTypeInfo);
      keyExprs.add(keyExp);
    }
    desc.setKeys(keyExprs);

    desc.getOutputColumnNames().add("_col1");

    return pair;
  }
Unit test for the vectorized GROUP BY operator.
ql/src/test/org/apache/hadoop/hive/ql/exec/vector/TestVectorGroupByOperator.java