This seems kind of brittle because it checks for the order of the elements, but the shuffle may have changed them. It just happens not to for integers because they hash to the right partitions. Mind changing the `toList` calls to `toSet`?