[SPARK-3032][Shuffle] Fix key comparison integer overflow introduced sorting exception

Previous key comparison in `ExternalSorter` will get wrong sorting result or exception when key comparison overflows, details can be seen in [SPARK-3032](https://issues.apache.org/jira/browse/SPARK-3032). Here fix this and add a unit test to prove it.
Seems these test data do not throw exception as "violates its general contract", but only give the wrong results. I'm not familiar with TimSort, probably this exception is not always happening, or the test data is not enough to reproduce the exception.