dongjoon-hyun commented on a change in pull request #25856: [SPARK-29182][Core]
Cache preferred locations of checkpointed RDD
URL: https://github.com/apache/spark/pull/25856#discussion_r326923177
##########
File path: core/src/test/scala/org/apache/spark/CheckpointSuite.scala
##########
@@ -618,4 +618,26 @@ class CheckpointCompressionSuite extends SparkFunSuite
with LocalSparkContext {
assert(rdd.collect().toSeq === (1 to 20))
}
}
+
+ test("cache checkpoint preferred location") {
+ withTempDir { checkpointDir =>
+ val conf = new SparkConf()
+ .set("spark.rdd.checkpoint.cachePreferredLocs", "true")
+ .set(UI_ENABLED.key, "false")
+ sc = new SparkContext("local", "test", conf)
+ sc.setCheckpointDir(checkpointDir.toString)
+ val rdd = sc.makeRDD(1 to 20, numSlices = 1)
+ rdd.checkpoint()
+ assert(rdd.collect().toSeq === (1 to 20))
+
+ // Verify that RDD is checkpointed
+ assert(rdd.firstParent.isInstanceOf[ReliableCheckpointRDD[_]])
+ val checkpointedRDD =
rdd.firstParent.asInstanceOf[ReliableCheckpointRDD[_]]
+ assert(!checkpointedRDD.cachedPreferredLocations.isDefinedAt(0))
+
+ val preferredLoc =
checkpointedRDD.preferredLocations(checkpointedRDD.partitions(0))
+ assert(checkpointedRDD.cachedPreferredLocations.isDefinedAt(0))
+ assert(preferredLoc == checkpointedRDD.cachedPreferredLocations(0))
Review comment:
`sc.stop()`?
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]