private Map<ExprNodeDesc, String> searchForEqualitiesInJoin(
            CommonJoinOperator<?> join, Set<ExprNodeColumnDesc> exprNodeDescSet) {
      Map<ExprNodeDesc, String> equalities = new HashMap<>();
      for (ExprNodeColumnDesc exprNodeDesc : exprNodeDescSet) {
        ExprNodeDesc mappedColExpr = join.getColumnExprMap().get(exprNodeDesc.getColumn());
        if (!(mappedColExpr instanceof ExprNodeColumnDesc)) {
          continue;
        }
        String mappedColName = ((ExprNodeColumnDesc)mappedColExpr).getColumn();
        int sideIndex = join.getConf().getReversedExprs().get(exprNodeDesc.getColumn());
        Operator<?> parentRSOperator = join.getParentOperators().get(sideIndex);
        for (int i = 0; i < join.getConf().getJoinKeys()[sideIndex].length; ++i) {
          ExprNodeDesc keyExpr = join.getConf().getJoinKeys()[sideIndex][i];
          if (!keyExpr.isSame(parentRSOperator.getColumnExprMap().get(mappedColName))) {
            continue;
          }

          // exprNodeDesc is join key
          // find the other key in the join expression
          Operator<?> otherParentRSOperator = join.getParentOperators().get(1 - sideIndex);
          for (Entry<String, ExprNodeDesc> joinMapEntry : join.getColumnExprMap().entrySet()) {
            if (join.getConf().getReversedExprs().get(joinMapEntry.getKey()) != 1 - sideIndex) {
              continue;
            }

            String otherColumnName = ((ExprNodeColumnDesc) joinMapEntry.getValue()).getColumn();
            ExprNodeDesc mappedOtherKeyExpr = otherParentRSOperator.getColumnExprMap().get(otherColumnName);
            ExprNodeDesc otherKeyExpr = join.getConf().getJoinKeys()[1 - sideIndex][i];
            if (mappedOtherKeyExpr != null && otherKeyExpr.isSame(mappedOtherKeyExpr)) {
              equalities.put(exprNodeDesc, joinMapEntry.getKey());
            }
          }
        }
      }

      for (Operator<?> parent : join.getParentOperators()) {
        equalities.putAll(searchForEqualities(parent, exprNodeDescSet));
      }

      return equalities;
    }
Search equal columns in the join expressions for each column specified in the given set.

@param join CommonJoinOperator which join expressions are scanned
@param exprNodeDescSet set of columns search equal columns for
@return Map of equal columns: key column coming from the passed exprNodeDescSet, value the name of equal input
column of current operator.
ql/src/java/org/apache/hadoop/hive/ql/ppd/OpProcFactory.java