Improve performance when computing partitions domain summary

This brings down the computation time from 70s (for 12k partitions) down to 250ms on my mac.
The previous algorithm was O(N^2) on the number of partitions times some non-obvious factor due
to how SortedRangeSet.union is implemented. There's still some room for improvement there.

Partial fix for https://github.com/facebook/presto/issues/1126