apache/incubator-spark — pull request #612 by guojc (2014-02-18 10:48:09+00:00)
Title: Fix ExternalMap on case of key's hashCode equal to Int.Maxvalue

Currently StreamBuffer use hash value to compare between buffers. And it want emmit
buffer with lowest HashValue from PriorityQue first and empty buffer last. And it use Int.MaxValue
for empty buffer. This can cause problem with non-empty buffer with HashValue equals to Int.MaxValue
and cause exception. This problem will happen with high probability when key size approach Int.MaxValue.

This fix change the compareTo method to comparing empty case first then hashValue and resolve the issue.