Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/5836#discussion_r29884623
--- Diff:
unsafe/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java ---
@@ -380,7 +405,13 @@ public void putNewKey(
bitset.set(pos);
// If there's not enough space in the current page, allocate a new
page:
- if (currentDataPage == null || PAGE_SIZE_BYTES - pageCursor <
requiredSize) {
+ if (currentDataPage == null || PAGE_SIZE_BYTES - pageCursor - 8 <
requiredSize) {
+ if (currentDataPage != null) {
--- End diff --
The fact that we have a check for `currentDataPage == null` in the outer if
loop and `currentDataPage != null` here implies that the outer loop's first or
branch is useless, since the body of the loop will never be executed if it
holds.
---
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]