Skip to content

Commit fb5869f

Browse files
Denis Bolshakovsrowen
authored andcommitted
[SPARK-9002][CORE] KryoSerializer initialization does not include 'Array[Int]'
[SPARK-9002][CORE] KryoSerializer initialization does not include 'Array[Int]' ## What changes were proposed in this pull request? Array[Int] has been registered in KryoSerializer. The following file has been changed core/src/main/scala/org/apache/spark/serializer/KryoSerializer.scala ## How was this patch tested? First, the issue was reproduced by new unit test. Then, the issue was fixed to pass the failed test. Author: Denis Bolshakov <[email protected]> Closes #17482 from dbolshak/SPARK-9002.
1 parent 364b0db commit fb5869f

File tree

2 files changed

+17
-0
lines changed

2 files changed

+17
-0
lines changed

core/src/main/scala/org/apache/spark/serializer/KryoSerializer.scala

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -384,9 +384,16 @@ private[serializer] object KryoSerializer {
384384
classOf[HighlyCompressedMapStatus],
385385
classOf[CompactBuffer[_]],
386386
classOf[BlockManagerId],
387+
classOf[Array[Boolean]],
387388
classOf[Array[Byte]],
388389
classOf[Array[Short]],
390+
classOf[Array[Int]],
389391
classOf[Array[Long]],
392+
classOf[Array[Float]],
393+
classOf[Array[Double]],
394+
classOf[Array[Char]],
395+
classOf[Array[String]],
396+
classOf[Array[Array[String]]],
390397
classOf[BoundedPriorityQueue[_]],
391398
classOf[SparkConf]
392399
)

core/src/test/scala/org/apache/spark/serializer/KryoSerializerSuite.scala

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,9 @@ class KryoSerializerSuite extends SparkFunSuite with SharedSparkContext {
7676
}
7777

7878
test("basic types") {
79+
val conf = new SparkConf(false)
80+
conf.set("spark.kryo.registrationRequired", "true")
81+
7982
val ser = new KryoSerializer(conf).newInstance()
8083
def check[T: ClassTag](t: T) {
8184
assert(ser.deserialize[T](ser.serialize(t)) === t)
@@ -106,6 +109,9 @@ class KryoSerializerSuite extends SparkFunSuite with SharedSparkContext {
106109
}
107110

108111
test("pairs") {
112+
val conf = new SparkConf(false)
113+
conf.set("spark.kryo.registrationRequired", "true")
114+
109115
val ser = new KryoSerializer(conf).newInstance()
110116
def check[T: ClassTag](t: T) {
111117
assert(ser.deserialize[T](ser.serialize(t)) === t)
@@ -130,12 +136,16 @@ class KryoSerializerSuite extends SparkFunSuite with SharedSparkContext {
130136
}
131137

132138
test("Scala data structures") {
139+
val conf = new SparkConf(false)
140+
conf.set("spark.kryo.registrationRequired", "true")
141+
133142
val ser = new KryoSerializer(conf).newInstance()
134143
def check[T: ClassTag](t: T) {
135144
assert(ser.deserialize[T](ser.serialize(t)) === t)
136145
}
137146
check(List[Int]())
138147
check(List[Int](1, 2, 3))
148+
check(Seq[Int](1, 2, 3))
139149
check(List[String]())
140150
check(List[String]("x", "y", "z"))
141151
check(None)

0 commit comments

Comments
 (0)