diff options
author | zsxwing <zsxwing@gmail.com> | 2014-04-24 11:13:40 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-04-24 11:13:40 -0700 |
commit | 78a49b2532d4751257654dfe55a564bcd10701b3 (patch) | |
tree | 7c96d13deb8841ff434e4b39c60630aef5b347a6 /core | |
parent | 6338a93f10e8b5f4365f71afd1086bdde64afad5 (diff) | |
download | spark-78a49b2532d4751257654dfe55a564bcd10701b3.tar.gz spark-78a49b2532d4751257654dfe55a564bcd10701b3.tar.bz2 spark-78a49b2532d4751257654dfe55a564bcd10701b3.zip |
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
Diffstat (limited to 'core')
-rw-r--r-- | core/src/main/scala/org/apache/spark/util/collection/AppendOnlyMap.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/core/src/main/scala/org/apache/spark/util/collection/AppendOnlyMap.scala b/core/src/main/scala/org/apache/spark/util/collection/AppendOnlyMap.scala index ad38250ad3..1a6f1c2b55 100644 --- a/core/src/main/scala/org/apache/spark/util/collection/AppendOnlyMap.scala +++ b/core/src/main/scala/org/apache/spark/util/collection/AppendOnlyMap.scala @@ -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) |