Skip to content
Snippets Groups Projects
Commit 78a49b25 authored by zsxwing's avatar zsxwing Committed by Patrick Wendell
Browse files

SPARK-1611: Fix incorrect initialization order in AppendOnlyMap

JIRA: https://issues.apache.org/jira/browse/SPARK-1611

Author: zsxwing <zsxwing@gmail.com>

Closes #534 from zsxwing/SPARK-1611 and squashes the following commits:

96af089 [zsxwing] SPARK-1611: Fix incorrect initialization order in AppendOnlyMap
parent 6338a93f
No related branches found
No related tags found
No related merge requests found
......@@ -40,6 +40,8 @@ class AppendOnlyMap[K, V](initialCapacity: Int = 64)
require(initialCapacity <= (1 << 29), "Can't make capacity bigger than 2^29 elements")
require(initialCapacity >= 1, "Invalid initial capacity")
private val LOAD_FACTOR = 0.7
private var capacity = nextPowerOf2(initialCapacity)
private var mask = capacity - 1
private var curSize = 0
......@@ -57,8 +59,6 @@ class AppendOnlyMap[K, V](initialCapacity: Int = 64)
private var destroyed = false
private val destructionMessage = "Map state is invalid from destructive sorting!"
private val LOAD_FACTOR = 0.7
/** Get the value for a given key */
def apply(key: K): V = {
assert(!destroyed, destructionMessage)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment