-
- Downloads
[SPARK-7251] Perform sequential scan when iterating over BytesToBytesMap
This patch modifies `BytesToBytesMap.iterator()` to iterate through records in the order that they appear in the data pages rather than iterating through the hashtable pointer arrays. This results in fewer random memory accesses, significantly improving performance for scan-and-copy operations. This is possible because our data pages are laid out as sequences of `[keyLength][data][valueLength][data]` entries. In order to mark the end of a partially-filled data page, we write `-1` as a special end-of-page length (BytesToByesMap supports empty/zero-length keys and values, which is why we had to use a negative length). This patch incorporates / closes #5836. Author: Josh Rosen <joshrosen@databricks.com> Closes #6159 from JoshRosen/SPARK-7251 and squashes the following commits: 05bd90a [Josh Rosen] Compare capacity, not size, to MAX_CAPACITY 2a20d71 [Josh Rosen] Fix maximum BytesToBytesMap capacity bc4854b [Josh Rosen] Guard against overflow when growing BytesToBytesMap f5feadf [Josh Rosen] Add test for iterating over an empty map 273b842 [Josh Rosen] [SPARK-7251] Perform sequential scan when iterating over entries in BytesToBytesMap
Showing
- unsafe/pom.xml 5 additions, 0 deletionsunsafe/pom.xml
- unsafe/src/main/java/org/apache/spark/unsafe/map/BytesToBytesMap.java 116 additions, 35 deletions...ain/java/org/apache/spark/unsafe/map/BytesToBytesMap.java
- unsafe/src/main/java/org/apache/spark/unsafe/map/HashMapGrowthStrategy.java 3 additions, 1 deletion...va/org/apache/spark/unsafe/map/HashMapGrowthStrategy.java
- unsafe/src/main/java/org/apache/spark/unsafe/memory/TaskMemoryManager.java 1 addition, 1 deletion...ava/org/apache/spark/unsafe/memory/TaskMemoryManager.java
- unsafe/src/test/java/org/apache/spark/unsafe/map/AbstractBytesToBytesMapSuite.java 149 additions, 16 deletions...apache/spark/unsafe/map/AbstractBytesToBytesMapSuite.java
Please register or sign in to comment