Skip to content

Commit a9b089a

Browse files
committed
Add unittest in ReplSuite Scala-2.11
1 parent 07160b9 commit a9b089a

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

repl/scala-2.11/src/test/scala/org/apache/spark/repl/ReplSuite.scala

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -473,4 +473,21 @@ class ReplSuite extends SparkFunSuite {
473473
assertDoesNotContain("AssertionError", output)
474474
assertDoesNotContain("Exception", output)
475475
}
476+
477+
test("SPARK-18189: Fix serialization issue in KeyValueGroupedDataset") {
478+
val resultValue = 12345
479+
val output = runInterpreter("local",
480+
s"""
481+
|val keyValueGrouped = Seq((1, 2), (3, 4)).toDS().groupByKey(_._1)
482+
|val mapGroups = keyValueGrouped.mapGroups((k, v) => (k, 1))
483+
|val broadcasted = sc.broadcast($resultValue)
484+
|
485+
|// Using broadcast triggers serialization issue in KeyValueGroupedDataset
486+
|val dataset = mapGroups.map(_ => broadcasted.value)
487+
|dataset.collect()
488+
""".stripMargin)
489+
assertDoesNotContain("error:", output)
490+
assertDoesNotContain("Exception", output)
491+
assertContains(s": Array[Int] = Array($resultValue, $resultValue)", output)
492+
}
476493
}

0 commit comments

Comments
 (0)