You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/11/25 05:54:25 UTC
[GitHub] [spark] MaxGekk commented on a diff in pull request #38782: [SPARK-38728][SQL] Test the error class: FAILED_RENAME_PATH
MaxGekk commented on code in PR #38782:
URL: https://github.com/apache/spark/pull/38782#discussion_r1032026249
##########
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:
You could use a fake file system to say that a file exists already, see
https://github.com/apache/spark/blob/91af7e8f562461bfdb686f383a0811a28772acf7/sql/core/src/test/scala/org/apache/spark/sql/errors/QueryExecutionErrorsSuite.scala#L426
--
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-unsubscribe@spark.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org