@@ -23,6 +23,7 @@ import org.scalatest.FunSuite
2323
2424import org .apache .spark .LocalSparkContext ._
2525import org .apache .spark .{TaskContext , SparkContext , SparkException }
26+ import org .apache .spark .partial .CountEvaluator
2627import org .apache .spark .rdd .RDD
2728
2829class ClosureCleanerSuite extends FunSuite {
@@ -110,6 +111,8 @@ class ClosureCleanerSuite extends FunSuite {
110111 expectCorrectException { TestUserClosuresActuallyCleaned .testForeachPartitionAsync(rdd) }
111112 expectCorrectException { TestUserClosuresActuallyCleaned .testRunJob1(sc) }
112113 expectCorrectException { TestUserClosuresActuallyCleaned .testRunJob2(sc) }
114+ expectCorrectException { TestUserClosuresActuallyCleaned .testRunApproximateJob(sc) }
115+ expectCorrectException { TestUserClosuresActuallyCleaned .testSubmitJob(sc) }
113116 }
114117 }
115118}
@@ -299,4 +302,20 @@ private object TestUserClosuresActuallyCleaned {
299302 val rdd = sc.parallelize(1 to 10 , 10 )
300303 sc.runJob(rdd, { iter : Iterator [Int ] => return ; 1 } )
301304 }
305+ def testRunApproximateJob (sc : SparkContext ): Unit = {
306+ val rdd = sc.parallelize(1 to 10 , 10 )
307+ val evaluator = new CountEvaluator (1 , 0.5 )
308+ sc.runApproximateJob(
309+ rdd, { (ctx : TaskContext , iter : Iterator [Int ]) => return ; 1L }, evaluator, 1000 )
310+ }
311+ def testSubmitJob (sc : SparkContext ): Unit = {
312+ val rdd = sc.parallelize(1 to 10 , 10 )
313+ sc.submitJob(
314+ rdd,
315+ { _ => return ; 1 }: Iterator [Int ] => Int ,
316+ Seq .empty,
317+ { case (_, _) => return }: (Int , Int ) => Unit ,
318+ { return }
319+ )
320+ }
302321}
0 commit comments