Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/10024#discussion_r60093876
--- Diff:
core/src/main/scala/org/apache/spark/util/collection/ExternalSorter.scala ---
@@ -235,6 +237,52 @@ private[spark] class ExternalSorter[K, V, C](
* @param collection whichever collection we're using (map or buffer)
*/
override protected[this] def spill(collection:
WritablePartitionedPairCollection[K, C]): Unit = {
+ val inMemoryIterator =
collection.destructiveSortedWritablePartitionedIterator(comparator)
+ val spillFile = spillMemoryIteratorToDisk(inMemoryIterator)
+ spills.append(spillFile)
+ }
+
+ /**
+ * Force to spilling the current in-memory collection to disk to release
memory,
+ * It will be called by TaskMemoryManager when there is not enough
memory for the task.
+ */
+ override protected[this] def forceSpill(): Boolean = {
+ if (isShuffleSort) {
--- End diff --
This could be triggered by a different thread, so it should be thread safe.
---
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]