Skip to content

Commit

Permalink
For comments.
Browse files Browse the repository at this point in the history
  • Loading branch information
viirya committed Oct 17, 2015
1 parent dc58498 commit 3958bc2
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 16 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -547,11 +547,6 @@ trait JavaRDDLike[T, This <: JavaRDDLike[T, This]] extends Serializable {
*/
def isCheckpointed: Boolean = rdd.isCheckpointed

/**
* Return whether this RDD has been checkpointed and materialized or not
*/
private[spark] def isCheckpointedAndMaterialized: Boolean = rdd.isCheckpointedAndMaterialized

/**
* Gets the name of the file to which this RDD was checkpointed
*/
Expand Down
7 changes: 4 additions & 3 deletions core/src/main/scala/org/apache/spark/rdd/RDD.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1544,13 +1544,14 @@ abstract class RDD[T: ClassTag](
}

/**
* Return whether this RDD is marked for checkpointing, either reliably or locally.
* Return whether this RDD is checkpointed and materialized, either reliably or locally.
*/
def isCheckpointed: Boolean = checkpointData.exists(_.isCheckpointed)

/**
* Return whether this RDD is marked for checkpointing and materialized,
* either reliably or locally.
* Return whether this RDD is checkpointed and materialized, either reliably or locally.
* This is introduced as an alias for `isCheckpointed` to clarify the semantics of the
* return value. Exposed for testing.
*/
private[spark] def isCheckpointedAndMaterialized: Boolean = isCheckpointed

Expand Down
8 changes: 0 additions & 8 deletions core/src/test/java/org/apache/spark/JavaAPISuite.java
Original file line number Diff line number Diff line change
Expand Up @@ -1420,13 +1420,9 @@ public void checkpointAndComputation() {
JavaRDD<Integer> rdd = sc.parallelize(Arrays.asList(1, 2, 3, 4, 5));
sc.setCheckpointDir(tempDir.getAbsolutePath());
Assert.assertFalse(rdd.isCheckpointed());
Assert.assertFalse(rdd.isCheckpointedAndMaterialized());
rdd.checkpoint();
Assert.assertFalse(rdd.isCheckpointed());
Assert.assertFalse(rdd.isCheckpointedAndMaterialized());
rdd.count(); // Forces the DAG to cause a checkpoint
Assert.assertTrue(rdd.isCheckpointed());
Assert.assertTrue(rdd.isCheckpointedAndMaterialized());
Assert.assertEquals(Arrays.asList(1, 2, 3, 4, 5), rdd.collect());
}

Expand All @@ -1435,13 +1431,9 @@ public void checkpointAndRestore() {
JavaRDD<Integer> rdd = sc.parallelize(Arrays.asList(1, 2, 3, 4, 5));
sc.setCheckpointDir(tempDir.getAbsolutePath());
Assert.assertFalse(rdd.isCheckpointed());
Assert.assertFalse(rdd.isCheckpointedAndMaterialized());
rdd.checkpoint();
Assert.assertFalse(rdd.isCheckpointed());
Assert.assertFalse(rdd.isCheckpointedAndMaterialized());
rdd.count(); // Forces the DAG to cause a checkpoint
Assert.assertTrue(rdd.isCheckpointed());
Assert.assertTrue(rdd.isCheckpointedAndMaterialized());

Assert.assertTrue(rdd.getCheckpointFile().isPresent());
JavaRDD<Integer> recovered = sc.checkpointFile(rdd.getCheckpointFile().get());
Expand Down

0 comments on commit 3958bc2

Please sign in to comment.