Github user aarondav commented on the pull request: https://github.com/apache/incubator-spark/pull/612#discussion_r9833685 This could be written pretty trivially using an Ordering, but I fear for the performance characteristics here, since this is a fast path. How does this look: ``` if (pairs.isEmpty || other.pairs.isEmpty) { -pairs.length.compareTo(other.pairs.length) } else { -minKeyHash.compareTo(other.minKeyHash) } ``` I think we may also need the `-` sign in front of the length for the same reason as we have it in the hash -- we want to invert the ordering since we deque the max not the min.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. To do so, please top-post your response. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. ---