diff options
author | Reynold Xin <rxin@apache.org> | 2014-06-25 12:43:22 -0700 |
---|---|---|
committer | Patrick Wendell <pwendell@gmail.com> | 2014-06-25 12:43:22 -0700 |
commit | 7ff2c754f340ba4c4077b0ff6285876eb7871c7b (patch) | |
tree | d759277343edf8f13a028ef247d448dc18bde669 /core/src/test | |
parent | 9aa603296c285e1acf4bde64583f203008ba3e91 (diff) | |
download | spark-7ff2c754f340ba4c4077b0ff6285876eb7871c7b.tar.gz spark-7ff2c754f340ba4c4077b0ff6285876eb7871c7b.tar.bz2 spark-7ff2c754f340ba4c4077b0ff6285876eb7871c7b.zip |
[SPARK-2270] Kryo cannot serialize results returned by asJavaIterable
and thus groupBy/cogroup are broken in Java APIs when Kryo is used).
@pwendell this should be merged into 1.0.1.
Thanks @sorenmacbeth for reporting this & helping out with the fix.
Author: Reynold Xin <rxin@apache.org>
Closes #1206 from rxin/kryo-iterable-2270 and squashes the following commits:
09da0aa [Reynold Xin] Updated the comment.
009bf64 [Reynold Xin] [SPARK-2270] Kryo cannot serialize results returned by asJavaIterable (and thus groupBy/cogroup are broken in Java APIs when Kryo is used).
Diffstat (limited to 'core/src/test')
-rw-r--r-- | core/src/test/scala/org/apache/spark/serializer/KryoSerializerSuite.scala | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/core/src/test/scala/org/apache/spark/serializer/KryoSerializerSuite.scala b/core/src/test/scala/org/apache/spark/serializer/KryoSerializerSuite.scala index cdd6b3d8fe..79280d1a06 100644 --- a/core/src/test/scala/org/apache/spark/serializer/KryoSerializerSuite.scala +++ b/core/src/test/scala/org/apache/spark/serializer/KryoSerializerSuite.scala @@ -128,6 +128,21 @@ class KryoSerializerSuite extends FunSuite with SharedSparkContext { check(1.0 until 1000000.0 by 2.0) } + test("asJavaIterable") { + // Serialize a collection wrapped by asJavaIterable + val ser = new KryoSerializer(conf).newInstance() + val a = ser.serialize(scala.collection.convert.WrapAsJava.asJavaIterable(Seq(12345))) + val b = ser.deserialize[java.lang.Iterable[Int]](a) + assert(b.iterator().next() === 12345) + + // Serialize a normal Java collection + val col = new java.util.ArrayList[Int] + col.add(54321) + val c = ser.serialize(col) + val d = ser.deserialize[java.lang.Iterable[Int]](c) + assert(b.iterator().next() === 12345) + } + test("custom registrator") { val ser = new KryoSerializer(conf).newInstance() def check[T: ClassTag](t: T) { |