Skip to content
Snippets Groups Projects
Commit 7d44dec9 authored by Aaron Davidson's avatar Aaron Davidson
Browse files

Fix weird bug with specialized PrimitiveVector

parent 7453f311
No related branches found
No related tags found
No related merge requests found
...@@ -21,7 +21,11 @@ package org.apache.spark.util.collection ...@@ -21,7 +21,11 @@ package org.apache.spark.util.collection
private[spark] private[spark]
class PrimitiveVector[@specialized(Long, Int, Double) V: ClassManifest](initialSize: Int = 64) { class PrimitiveVector[@specialized(Long, Int, Double) V: ClassManifest](initialSize: Int = 64) {
private var numElements = 0 private var numElements = 0
private var array = new Array[V](initialSize) private var array: Array[V] = _
// NB: This must be separate from the declaration, otherwise the specialized parent class
// will get its own array with the same initial size. TODO: Figure out why...
array = new Array[V](initialSize)
def apply(index: Int): V = { def apply(index: Int): V = {
require(index < numElements) require(index < numElements)
......
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