private static long estimateReducers(HiveConf conf, ReduceSinkOperator rs) {
    // TODO: Check if we can somehow exploit the logic in SetReducerParallelism
    if (rs.getConf().getNumReducers() > 0) {
      return rs.getConf().getNumReducers();
    }
    int constantReducers = conf.getIntVar(HiveConf.ConfVars.HADOOP_NUM_REDUCERS);
    if (constantReducers > 0) {
      return constantReducers;
    }
    long inputTotalBytes = 0;
    List<Operator<?>> rsSiblings = rs.getChildOperators().get(0).getParentOperators();
    for (Operator<?> sibling : rsSiblings) {
      if (sibling.getStatistics() != null) {
        inputTotalBytes = StatsUtils.safeAdd(inputTotalBytes, sibling.getStatistics().getDataSize());
      }
    }
    int maxReducers = conf.getIntVar(HiveConf.ConfVars.MAX_REDUCERS);
    long bytesPerReducer = conf.getLongVar(HiveConf.ConfVars.BYTES_PER_REDUCER);
    return Utilities.estimateReducers(inputTotalBytes, bytesPerReducer, maxReducers, false);
  }
Current RSDedup remove/replace child RS. For key columns,
sorting order, and the number of reducers, copy
more specific part of configurations of child RS to that of parent RS.
For partitioning columns, if both child RS and parent RS have been assigned
partitioning columns, we will choose the more general partitioning columns.
If parent RS has not been assigned any partitioning column, we will use
partitioning columns (if exist) of child RS.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/correlation/ReduceSinkDeDuplicationUtils.java