Skip to content

Commit 44a9b55

Browse files
committed
Add test of a buggy getPartitions() method
1 parent 19aa9f7 commit 44a9b55

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

core/src/test/scala/org/apache/spark/scheduler/DAGSchedulerSuite.scala

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -784,6 +784,21 @@ class DAGSchedulerSuite
784784
assert(sc.parallelize(1 to 10, 2).first() === 1)
785785
}
786786

787+
test("getPartitions exceptions should not crash DAGScheduler and SparkContext (SPARK-8606)") {
788+
val e1 = intercept[DAGSchedulerSuiteDummyException] {
789+
val rdd = new MyRDD(sc, 2, Nil) {
790+
override def getPartitions: Array[Partition] = {
791+
throw new DAGSchedulerSuiteDummyException
792+
}
793+
}
794+
rdd.reduceByKey(_ + _, 1).count()
795+
}
796+
797+
// Make sure we can still run local commands as well as cluster commands.
798+
assert(sc.parallelize(1 to 10, 2).count() === 10)
799+
assert(sc.parallelize(1 to 10, 2).first() === 1)
800+
}
801+
787802
test("getPreferredLocations errors should not crash DAGScheduler and SparkContext (SPARK-8606)") {
788803
val e1 = intercept[DAGSchedulerSuiteDummyException] {
789804
val rdd = new MyRDD(sc, 2, Nil) {

0 commit comments

Comments
 (0)