private void addGroupingSetKey(List<ExprNodeDesc> groupByKeys,
                                 RowResolver groupByInputRowResolver,
                                 RowResolver groupByOutputRowResolver,
                                 List<String> outputColumnNames,
                                 Map<String, ExprNodeDesc> colExprMap) throws SemanticException {
    // For grouping sets, add a dummy grouping key
    String groupingSetColumnName =
        groupByInputRowResolver.get(null, VirtualColumn.GROUPINGID.getName()).getInternalName();
    ExprNodeDesc inputExpr = new ExprNodeColumnDesc(VirtualColumn.GROUPINGID.getTypeInfo(),
        groupingSetColumnName, null, false);
    groupByKeys.add(inputExpr);

    String field = getColumnInternalName(groupByKeys.size() - 1);
    outputColumnNames.add(field);
    groupByOutputRowResolver.put(null, VirtualColumn.GROUPINGID.getName(),
        new ColumnInfo(
            field,
            VirtualColumn.GROUPINGID.getTypeInfo(),
            null,
            true));
    colExprMap.put(field, groupByKeys.get(groupByKeys.size() - 1));
  }
Generate the GroupByOperator for the Query Block (parseInfo.getXXX(dest)).
The new GroupByOperator will be a child of the reduceSinkOperatorInfo.

@param mode
         The mode of the aggregation (PARTIAL1 or COMPLETE)
@param genericUDAFEvaluators
         If not null, this function will store the mapping from Aggregation
         StringTree to the genericUDAFEvaluator in this parameter, so it
         can be used in the next-stage GroupBy aggregations.
@return the new GroupByOperator
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java