File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
core/src/test/scala/org/apache/spark/util Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -93,6 +93,7 @@ class ClosureCleanerSuite extends FunSuite {
9393 expectCorrectException { TestUserClosuresActuallyCleaned .testMapPartitions(rdd) }
9494 expectCorrectException { TestUserClosuresActuallyCleaned .testMapPartitionsWithIndex(rdd) }
9595 expectCorrectException { TestUserClosuresActuallyCleaned .testFlatMapWith(rdd) }
96+ expectCorrectException { TestUserClosuresActuallyCleaned .testMapWith(rdd) }
9697 expectCorrectException { TestUserClosuresActuallyCleaned .testZipPartitions2(rdd) }
9798 expectCorrectException { TestUserClosuresActuallyCleaned .testZipPartitions3(rdd) }
9899 expectCorrectException { TestUserClosuresActuallyCleaned .testZipPartitions4(rdd) }
@@ -269,7 +270,12 @@ private object TestUserClosuresActuallyCleaned {
269270 val random = prng.nextDouble()
270271 Seq (random * t, random * t * 10 )}.
271272 count()
272- rdd.mapPartitionsWithIndex { (_, it) => return ; it }.count()
273+ }
274+ def testMapWith (rdd : RDD [Int ]): Unit = {
275+ import java .util .Random
276+ val randoms = rdd.mapWith(
277+ (index : Int ) => new Random (index + 42 ))
278+ {(t : Int , prng : Random ) => prng.nextDouble * t}.count()
273279 }
274280 def testZipPartitions2 (rdd : RDD [Int ]): Unit = {
275281 rdd.zipPartitions(rdd) { case (it1, it2) => return ; it1 }.count()
You can’t perform that action at this time.
0 commit comments