private void getReduceValuesForReduceSinkNoMapAgg(QBParseInfo parseInfo, String dest,
                                                    RowResolver reduceSinkInputRowResolver,
                                                    RowResolver reduceSinkOutputRowResolver,
                                                    List<String> outputValueColumnNames,
                                                    List<ExprNodeDesc> reduceValues,
                                                    Map<String, ExprNodeDesc> colExprMap) throws SemanticException {
    Map<String, ASTNode> aggregationTrees = parseInfo.getAggregationExprsForClause(dest);

    // Put parameters to aggregations in reduceValues
    for (Map.Entry<String, ASTNode> entry : aggregationTrees.entrySet()) {
      ASTNode value = entry.getValue();
      // 0 is function name
      for (int i = 1; i < value.getChildCount(); i++) {
        ASTNode parameter = (ASTNode) value.getChild(i);
        if (reduceSinkOutputRowResolver.getExpression(parameter) == null) {
          ExprNodeDesc exprDesc = genExprNodeDesc(parameter, reduceSinkInputRowResolver);
          reduceValues.add(exprDesc);
          outputValueColumnNames
              .add(getColumnInternalName(reduceValues.size() - 1));
          String field = Utilities.ReduceField.VALUE.toString() + "."
              + getColumnInternalName(reduceValues.size() - 1);
          reduceSinkOutputRowResolver.putExpression(parameter, new ColumnInfo(field,
              reduceValues.get(reduceValues.size() - 1).getTypeInfo(), null,
              false));
          colExprMap.put(field, exprDesc);
        }
      }
    }
  }
Generate the ReduceSinkOperator for the Group By Query Block
(qb.getPartInfo().getXXX(dest)). The new ReduceSinkOperator will be a child
of inputOperatorInfo.

It will put all Group By keys and the distinct field (if any) in the
map-reduce sort key, and all other fields in the map-reduce value.

@param numPartitionFields
         the number of fields for map-reduce partitioning. This is usually
         the number of fields in the Group By keys.
@return the new ReduceSinkOperator.
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java