Description
Set<RexTableInputRef> c1 = nodeToEquivalenceClass.get(p1); Set<RexTableInputRef> c2 = nodeToEquivalenceClass.get(p2); if (c1 != null && c2 != null) { // Both present, we need to merge if (c1.size() < c2.size()) { // We swap them to merge c1 = c2; // <-- HERE. Should c1 and c2 be actually swapped? p1 = p2; // <-- What does this mean? p1 and p2 are not used. Should they be swapped as well just in case } for (RexTableInputRef newRef : c2) { c1.add(newRef); nodeToEquivalenceClass.put(newRef, c1); }
It looks like c1 vs c2 swap is missing, and a mere c1=c2 is used.
It would likely produce weird results.