protected static Integer sameKeys(List<ExprNodeDesc> cexprs, List<ExprNodeDesc> pexprs,
      Operator<?> child, Operator<?> parent) throws SemanticException {
    int common = Math.min(cexprs.size(), pexprs.size());
    int limit = Math.max(cexprs.size(), pexprs.size());
    int i = 0;
    for (; i < common; i++) {
      ExprNodeDesc pexpr = pexprs.get(i);
      ExprNodeDesc cexpr = ExprNodeDescUtils.backtrack(cexprs.get(i), child, parent);
      if (cexpr == null || !pexpr.isSame(cexpr)) {
        return null;
      }
    }
    for (; i < limit; i++) {
      if (cexprs.size() > pexprs.size()) {
        if (ExprNodeDescUtils.backtrack(cexprs.get(i), child, parent) == null) {
          // cKey is not present in parent
          return null;
        }
      }
    }
    return Integer.valueOf(cexprs.size()).compareTo(pexprs.size());
  }
Overlapping part of keys should be the same between parent and child.
And if child has more keys than parent, non-overlapping part of keys
should be backtrackable to parent.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/correlation/ReduceSinkDeDuplicationUtils.java