private void processGroupingSetReduceSinkOperator(RowResolver reduceSinkInputRowResolver,
                                                    RowResolver reduceSinkOutputRowResolver,
                                                    List<ExprNodeDesc> reduceKeys,
                                                    List<String> outputKeyColumnNames,
                                                    Map<String, ExprNodeDesc> colExprMap) throws SemanticException {
    // add a key for reduce sink
    String groupingSetColumnName =
        reduceSinkInputRowResolver.get(null, VirtualColumn.GROUPINGID.getName()).getInternalName();
    ExprNodeDesc inputExpr = new ExprNodeColumnDesc(VirtualColumn.GROUPINGID.getTypeInfo(),
        groupingSetColumnName, null, false);
    reduceKeys.add(inputExpr);

    outputKeyColumnNames.add(getColumnInternalName(reduceKeys.size() - 1));
    String field = Utilities.ReduceField.KEY.toString() + "."
        + getColumnInternalName(reduceKeys.size() - 1);
    ColumnInfo colInfo = new ColumnInfo(field, reduceKeys.get(
        reduceKeys.size() - 1).getTypeInfo(), null, true);
    reduceSinkOutputRowResolver.put(null, VirtualColumn.GROUPINGID.getName(), colInfo);
    colExprMap.put(colInfo.getInternalName(), inputExpr);
  }
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