private static List<RexNode> createInClauses(RexBuilder rexBuilder, Set<RexNode> visitedRefs,
        Multimap<RexNode, SimilarRexNodeElement> inLHSExprToRHSExprs, Multimap<RexNode,RexNode> inLHSExprToRHSNullableExprs) {
      final List<RexNode> newExpressions = new ArrayList<>();
      for (RexNode ref : visitedRefs) {
        Collection<SimilarRexNodeElement> exprs = inLHSExprToRHSExprs.get(ref);
        if (exprs.isEmpty()) {
          // Note that Multimap does not keep a key if all its values are removed.
          newExpressions.add(createResultFromEmptySet(rexBuilder, ref, inLHSExprToRHSNullableExprs));
        } else if (exprs.size() == 1) {
          List<RexNode> newOperands = new ArrayList<>(2);
          newOperands.add(ref);
          newOperands.add(exprs.iterator().next().getRexNode());
          newExpressions.add(rexBuilder.makeCall(SqlStdOperatorTable.EQUALS, newOperands));
        } else {
          List<RexNode> newOperands = new ArrayList<>(exprs.size() + 1);
          newOperands.add(ref);
          newOperands.addAll(exprs.stream().map(SimilarRexNodeElement::getRexNode).collect(Collectors.toList()));
          newExpressions.add(rexBuilder.makeCall(HiveIn.INSTANCE, newOperands));
        }
      }
      return newExpressions;
    }
Check if the type of nodes in the two collections is homogeneous within the collections
and identical between them.
@param nodes1 the first collection of nodes
@param nodes2 the second collection of nodes
@return true if nodes in both collections is unique and identical, false otherwise
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/rules/HivePointLookupOptimizerRule.java