Github user JoshRosen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/4450#discussion_r30966102
  
    --- Diff: 
core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
    @@ -306,14 +297,10 @@ private[spark] class ExternalSorter[K, V, C](
     
         var success = false
         try {
    -      val it = collection.destructiveSortedIterator(partitionKeyComparator)
    +      val it = 
collection.destructiveSortedWritablePartitionedIterator(comparator)
           while (it.hasNext) {
    -        val elem = it.next()
    -        val partitionId = elem._1._1
    -        val key = elem._1._2
    -        val value = elem._2
    -        writer.write(key)
    -        writer.write(value)
    +        val partitionId = it.nextPartition()
    +        it.writeNext(writer)
             elementsPerPartition(partitionId) += 1
             objectsWritten += 1
    --- End diff --
    
    Actually, I retract this comment: I got confused because `nextPartition` 
sort of sounded like we were striding across a partition boundary.  It looks 
like this code is fine, even if it's somewhat confusing.


---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. 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 [email protected] or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to