presto-main/src/main/java/io/prestosql/util/DisjointSet.java/DisjointSet/union
class DisjointSet:    private boolean union(T root1, T root2)
    {
        if (root1.equals(root2)) {
            return false;
        }
        Entry<T> entry1 = map.get(root1);
        Entry<T> entry2 = map.get(root2);
        int entry1Rank = entry1.getRank();
        int entry2Rank = entry2.getRank();
        verify(entry1Rank >= 0);
        verify(entry2Rank >= 0);
        if (entry1Rank < entry2Rank) {
            // make root1 child of root2
            entry1.setParent(root2);
        }
        else {
            if (entry1Rank == entry2Rank) {
                // increment rank of root1 when both side were equally deep
                entry1.incrementRank();
            }
            // make root2 child of root1
            entry2.setParent(root1);
        }
        return true;
    }