Github user gatorsmile commented on a diff in the pull request:

    https://github.com/apache/spark/pull/19805#discussion_r157361491
  
    --- Diff: sql/core/src/test/scala/org/apache/spark/sql/DatasetSuite.scala 
---
    @@ -1156,67 +1156,83 @@ class DatasetSuite extends QueryTest with 
SharedSQLContext {
       }
     
       Seq(true, false).foreach { eager =>
    -    def testCheckpointing(testName: String)(f: => Unit): Unit = {
    -      test(s"Dataset.checkpoint() - $testName (eager = $eager)") {
    -        withTempDir { dir =>
    -          val originalCheckpointDir = spark.sparkContext.checkpointDir
    -
    -          try {
    -            spark.sparkContext.setCheckpointDir(dir.getCanonicalPath)
    +    Seq(true, false).foreach { reliable =>
    +      def testCheckpointing(testName: String)(f: => Unit): Unit = {
    +        test(s"Dataset.checkpoint() - $testName (eager = $eager, reliable 
= $reliable)") {
    +          if (reliable) {
    +            withTempDir { dir =>
    +              val originalCheckpointDir = spark.sparkContext.checkpointDir
    +
    +              try {
    +                spark.sparkContext.setCheckpointDir(dir.getCanonicalPath)
    +                f
    +              } finally {
    +                // Since the original checkpointDir can be None, we need
    +                // to set the variable directly.
    +                spark.sparkContext.checkpointDir = originalCheckpointDir
    +              }
    +            }
    +          }
    +          else {
    --- End diff --
    
    -> `} else {`


---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to