Github user davies commented on a diff in the pull request:
https://github.com/apache/spark/pull/13318#discussion_r65753668
--- Diff:
core/src/main/java/org/apache/spark/shuffle/sort/ShuffleInMemorySorter.java ---
@@ -70,9 +70,14 @@ public int compare(PackedRecordPointer left,
PackedRecordPointer right) {
assert (initialSize > 0);
this.initialSize = initialSize;
this.useRadixSort = useRadixSort;
- this.memoryAllocationFactor = useRadixSort ? 2 : 1;
this.array = consumer.allocateArray(initialSize);
- this.sorter = new Sorter<>(ShuffleSortDataFormat.INSTANCE);
+ this.usableCapacity = calcCapacity();
+ }
+
+ private int calcCapacity() {
+ // Radix sort requires same amount of used memory as buffer, Tim sort
requires
+ // half of the used memory as buffer.
--- End diff --
@sameeragarwal I think you already had a test case for the worst case
(there are two ordered part in the array, the shortest part will be copied into
a temporary buffer, os it need 0.5 buffer space), it's doced in TimSort.
---
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]