The sorting reads code uses the default hash partitioner. In the initial implementation, I put all the unmapped reads at the end of the file using referenceId=Int.MaxValue which lead to an uneven distribution. The fix was simply to place the unmapped reads at a range of positions at the end of the file (Int.MaxValue-10000, Int.MaxValue].

````
    val unmappedReferenceIds = new Iterator[Int] with Serializable {
      var currentOffsetFromEnd = 0

      def hasNext: Boolean = true

      def next(): Int = {
        currentOffsetFromEnd += 1
        if (currentOffsetFromEnd > 10000) {
          currentOffsetFromEnd = 0
        }
        Int.MaxValue - currentOffsetFromEnd
      }
    }
````
What do you guys think is the best way to handle unmapped reads in this partitioner code? Currently, it looks like unmapped reads get put into the same partition as reads mapped to position zero? That will likely cause key skew, no?