ibuder commented on code in PR #38782:
URL: https://github.com/apache/spark/pull/38782#discussion_r1032017014


##########
sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala:
##########
@@ -637,6 +637,33 @@ class QueryExecutionErrorsSuite
       sqlState = "0A000")
   }
 
+  test("FAILED_RENAME_PATH: rename when destination path already exists") {
+    var srcPath: Path = null
+    var dstPath: Path = null
+
+    val e = intercept[SparkFileAlreadyExistsException](
+      withTempPath { p =>
+        val basePath = new Path(p.getAbsolutePath)
+        val fm = new FileSystemBasedCheckpointFileManager(basePath, new 
Configuration())
+        srcPath = new Path(s"$basePath/src")
+        fm.createAtomic(srcPath, overwriteIfPossible = true).close()
+        dstPath = new Path(s"$basePath/dst")
+        fm.createAtomic(dstPath, overwriteIfPossible = true).close()
+
+        fm.renameTempFile(srcPath, dstPath, false)

Review Comment:
   @LuciferYang I couldn't think of a simple way of triggering this error 
through the user-facing API. I think the only code that raises it is in 
[CheckpointFileManager](https://github.com/apache/spark/blob/b84ddd5e71acc9ae3facdf47148becef3861d11d/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/CheckpointFileManager.scala#L268).
 The destination path is [generated 
randomly](https://github.com/apache/spark/blob/b84ddd5e71acc9ae3facdf47148becef3861d11d/sql/core/src/main/scala/org/apache/spark/sql/execution/streaming/CheckpointFileManager.scala#L224)
 and not accessible by any user-facing API I could find.
   
   Do you have a suggestion for how to trigger this error through the 
user-facing API?



-- 
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.

To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


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

Reply via email to