dongjoon-hyun commented on code in PR #51932:
URL: https://github.com/apache/spark/pull/51932#discussion_r2263866379
##########
common/utils/src/main/scala/org/apache/spark/util/SparkFileUtils.scala:
##########
@@ -134,6 +134,16 @@ private[spark] trait SparkFileUtils extends Logging {
createDirectory(root, namePrefix)
}
+ def createParentDirs(file: File): Unit = {
+ if (file == null) {
+ throw new IllegalArgumentException("Input should not be null.")
+ }
+ val parent = file.getParentFile()
+ if (parent != null) {
+ Files.createDirectories(parent.toPath())
Review Comment:
`Files.createDirectories` is a newer API than `File.mkdirs`. In our case,
we just want to make it sure that the directory exists. Since
`Files.createDirectories` doesn't complain on the existing directory. That
works for our use case.
--
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: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]