You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@spark.apache.org by pw...@apache.org on 2014/04/24 20:13:52 UTC

git commit: SPARK-1611: Fix incorrect initialization order in AppendOnlyMap

Repository: spark
Updated Branches:
  refs/heads/master 6338a93f1 -> 78a49b253


SPARK-1611: Fix incorrect initialization order in AppendOnlyMap

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

Author: zsxwing <zs...@gmail.com>

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

96af089 [zsxwing] SPARK-1611: Fix incorrect initialization order in AppendOnlyMap


Project: http://git-wip-us.apache.org/repos/asf/spark/repo
Commit: http://git-wip-us.apache.org/repos/asf/spark/commit/78a49b25
Tree: http://git-wip-us.apache.org/repos/asf/spark/tree/78a49b25
Diff: http://git-wip-us.apache.org/repos/asf/spark/diff/78a49b25

Branch: refs/heads/master
Commit: 78a49b2532d4751257654dfe55a564bcd10701b3
Parents: 6338a93
Author: zsxwing <zs...@gmail.com>
Authored: Thu Apr 24 11:13:40 2014 -0700
Committer: Patrick Wendell <pw...@gmail.com>
Committed: Thu Apr 24 11:13:40 2014 -0700

----------------------------------------------------------------------
 .../scala/org/apache/spark/util/collection/AppendOnlyMap.scala   | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/spark/blob/78a49b25/core/src/main/scala/org/apache/spark/util/collection/AppendOnlyMap.scala
----------------------------------------------------------------------
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 ad38250..1a6f1c2 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)