cloud-fan commented on a change in pull request #29744:
URL: https://github.com/apache/spark/pull/29744#discussion_r487650024



##########
File path: core/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java
##########
@@ -816,6 +816,12 @@ public boolean append(Object kbase, long koff, int klen, 
Object vbase, long voff
           } catch (SparkOutOfMemoryError oom) {
             canGrowArray = false;
           }
+        } else if (numKeys >= growthThreshold && longArray.size() / 2 >= 
MAX_CAPACITY) {

Review comment:
       it should be more readable to combine the common condition:
   ```
   // The map has reached its growth threshold, try to grow it
   if (numKeys >= growthThreshold) {
     // We use two array entries per key ...
     if (longArray.size() / 2 < MAX_CAPACITY) {
        ...
     } else {
       // It's already at MAX_CAPACITY and cannot grow ...
       canGrowArray = false;
     }
   }
   ```




----------------------------------------------------------------
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]

Reply via email to