protected static Integer checkOrder(boolean checkStrictEquality, String corder, String porder,
          String cNullOrder, String pNullOrder) {
    assert corder.length() == cNullOrder.length();
    assert porder.length() == pNullOrder.length();
    if (corder == null || corder.trim().equals("")) {
      if (porder == null || porder.trim().equals("")) {
        return 0;
      }
      return -1;
    }
    if (porder == null || porder.trim().equals("")) {
      return 1;
    }
    corder = corder.trim();
    porder = porder.trim();
    if (checkStrictEquality) {
      // order of overlapping keys should be exactly the same
      cNullOrder = cNullOrder.trim();
      pNullOrder = pNullOrder.trim();
      int target = Math.min(corder.length(), porder.length());
      if (!corder.substring(0, target).equals(porder.substring(0, target)) ||
              !cNullOrder.substring(0, target).equals(pNullOrder.substring(0, target))) {
        return null;
      }
    }
    return Integer.valueOf(corder.length()).compareTo(porder.length());
  }
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