protected static SelectOperator replaceReduceSinkWithSelectOperator(ReduceSinkOperator childRS,
      ParseContext context, AbstractCorrelationProcCtx procCtx) throws SemanticException {
    RowSchema inputRS = childRS.getSchema();

    List<String> columnNames = new ArrayList<String>();

    for (String colName : childRS.getConf().getOutputValueColumnNames()) {
      columnNames.add("VALUE." + colName);
    }
    for (String colName : childRS.getConf().getOutputKeyColumnNames()) {
      columnNames.add("KEY." + colName);
    }

    List<ExprNodeDesc> colExprs = new ArrayList<ExprNodeDesc>();
    colExprs.addAll(childRS.getConf().getKeyCols());
    colExprs.addAll(childRS.getConf().getValueCols());

    SelectDesc select = new SelectDesc(colExprs, columnNames);

    Operator<?> parent = getSingleParent(childRS);
    parent.removeChild(childRS);

    SelectOperator sel = (SelectOperator) OperatorFactory.getAndMakeChild(
            select, new RowSchema(inputRS.getSignature()), parent);

    sel.setColumnExprMap(childRS.getColumnExprMap());

    sel.setChildOperators(childRS.getChildOperators());
    for (Operator<? extends Serializable> ch : childRS.getChildOperators()) {
      ch.replaceParent(childRS, sel);
    }

    childRS.setChildOperators(null);
    childRS.setParentOperators(null);
    procCtx.addRemovedOperator(childRS);
    return sel;
  }
Find all sibling operators (which have the same child operator of op) of op (op
included).
@throws SemanticException
ql/src/java/org/apache/hadoop/hive/ql/optimizer/correlation/CorrelationUtilities.java