Github user pwendell commented on a diff in the pull request:
https://github.com/apache/spark/pull/4450#discussion_r29118071
--- Diff:
core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
@@ -740,15 +723,29 @@ private[spark] class ExternalSorter[K, V, C](
in.close()
}
}
+ } else if (spills.isEmpty && partitionWriters == null) {
+ // Case where we only have in-memory data
+ val collection = if (aggregator.isDefined) map else buffer
+ val it =
collection.destructiveSortedWritablePartitionedIterator(comparator)
+ while (it.hasNext) {
+ val writer = blockManager.getDiskWriter(
+ blockId, outputFile, ser, fileBufferSize,
context.taskMetrics.shuffleWriteMetrics.get)
+ val partitionId = it.nextPartition()
+ while (it.hasNext && it.nextPartition() == partitionId) {
+ it.writeNext(writer)
+ }
+ writer.commitAndClose()
+ val segment = writer.fileSegment()
+ lengths(partitionId) = segment.length
+ }
} else {
- // Either we're not bypassing merge-sort or we have only in-memory
data; get an iterator by
- // partition and just write everything directly.
+ // Not bypassing merge-sort; get an iterator by partition and just
write everything directly.
--- End diff --
Is the following true: If at least one spill has occurred from the
partitioned buffer, the data that is in the present buffer will be
de-serialized and then re-serialized as it's written to disk?
---
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]