ankurdave commented on a change in pull request #26828:
URL: https://github.com/apache/spark/pull/26828#discussion_r487577743
##########
File path: core/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java
##########
@@ -741,7 +741,9 @@ public boolean append(Object kbase, long koff, int klen,
Object vbase, long voff
longArray.set(pos * 2 + 1, keyHashcode);
isDefined = true;
- if (numKeys >= growthThreshold && longArray.size() < MAX_CAPACITY) {
+ // We use two array entries per key, so the array size is twice the
capacity.
+ // We should compare the current capacity of the array, instead of its
size.
+ if (numKeys >= growthThreshold && longArray.size() / 2 < MAX_CAPACITY)
{
try {
growAndRehash();
Review comment:
> Sounds like you are encountering another problem?
You're right, it's not the same problem - I was mistaken in saying so
earlier.
> In UnsafeKVExternalSorter, it will check if the long array can be reused
or not. Isn't? If it cannot be reused, a new pointer array will be created, no?
Yes, but by this point the task has typically consumed all available memory,
so the allocation of the new pointer array is likely to fail.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]