Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/4450#discussion_r30963215
--- 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 --
Is this still correct? Based on my understanding of
`destructiveSortedWritablePartitionedIterator` (which is kind of a mouthful!),
it looks like the `it.writeNext(writer)` call should be writing an entire
partition's worth of records to the output, but here and on the previous line
we're performing some increments that I think only make sense for a
record-at-a-time iterator, which we're no longer using in this block.
---
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]