From 5f6bdf97c5d2d78db0ca39703084d8ae377346b8 Mon Sep 17 00:00:00 2001 From: Wesley Tang Date: Wed, 16 Mar 2016 16:12:17 +0000 Subject: [SPARK-13281][CORE] Switch broadcast of RDD to exception from warning ## What changes were proposed in this pull request? In SparkContext, throw Illegalargumentexception when trying to broadcast rdd directly, instead of logging the warning. ## How was this patch tested? mvn clean install Add UT in BroadcastSuite Author: Wesley Tang Closes #11735 from breakdawn/master. --- .../src/test/scala/org/apache/spark/broadcast/BroadcastSuite.scala | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'core/src/test/scala/org/apache') diff --git a/core/src/test/scala/org/apache/spark/broadcast/BroadcastSuite.scala b/core/src/test/scala/org/apache/spark/broadcast/BroadcastSuite.scala index f97cfbba32..6657104823 100644 --- a/core/src/test/scala/org/apache/spark/broadcast/BroadcastSuite.scala +++ b/core/src/test/scala/org/apache/spark/broadcast/BroadcastSuite.scala @@ -130,6 +130,13 @@ class BroadcastSuite extends SparkFunSuite with LocalSparkContext { assert(thrown.getMessage.toLowerCase.contains("stopped")) } + test("Forbid broadcasting RDD directly") { + sc = new SparkContext(new SparkConf().setAppName("test").setMaster("local")) + val rdd = sc.parallelize(1 to 4) + intercept[IllegalArgumentException] { sc.broadcast(rdd) } + sc.stop() + } + /** * Verify the persistence of state associated with an TorrentBroadcast in a local-cluster. * -- cgit v1.2.3