protected Set<RexCall> removeEquivalence(RexTableInputRef p1, RexTableInputRef p2) {
      nodeToEquivalenceClass.get(p1).remove(p2);
      if (nodeToEquivalenceClass.get(p1).size() == 1) { // self
        nodeToEquivalenceClass.remove(p1);
      }
      nodeToEquivalenceClass.get(p2).remove(p1);
      if (nodeToEquivalenceClass.get(p2).size() == 1) { // self
        nodeToEquivalenceClass.remove(p2);
      }
      Set<RexCall> originalNodes = new HashSet<>();
      originalNodes.addAll(equivalenceToOriginalNode.removeAll(Pair.of(p1, p2)));
      originalNodes.addAll(equivalenceToOriginalNode.removeAll(Pair.of(p2, p1)));
      return originalNodes;
    }
Class representing an equivalence class, i.e., a set of equivalent columns

TODO: This is a subset of a private class in materialized view rewriting
in Calcite. It should be moved to its own class in Calcite so it can be
accessible here.
ql/src/java/org/apache/hadoop/hive/ql/optimizer/calcite/HiveRelOptUtil.java