Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/9383#discussion_r43784097
--- Diff:
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
---
@@ -386,6 +386,18 @@ public void insertKVRecord(Object keyBase, long
keyOffset, int keyLen,
}
/**
+ * Merges another UnsafeExternalSorters into this one, the other one
will be emptied.
+ *
+ * @throws IOException
+ */
+ public void merge(UnsafeExternalSorter other) throws IOException {
+ other.spill();
+ spillWriters.addAll(other.spillWriters);
+ other.spillWriters.clear();
+ other.cleanupResources();
--- End diff --
Ordinarily, this would end up deleting the spill files, but it doesn't
because of the `spillWriters.clear()` call above. If you end up updating this
patch, mind adding a one-line comment to explain this (since it's a subtle
point)?
---
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]