Github user mgaido91 commented on a diff in the pull request: https://github.com/apache/spark/pull/22078#discussion_r209430770 --- Diff: core/src/main/scala/org/apache/spark/internal/io/FileCommitProtocol.scala --- @@ -124,6 +124,25 @@ abstract class FileCommitProtocol { fs.delete(path, recursive) } + /** + * Specifies that a directory should be truncated with the commit of this job. The default + * implementation deletes the file immediately. + * + * Return true if this directory is empty or deleted all files in this directory, otherwise false. + */ + def truncateDirectoryWithJob(fs: FileSystem, directory: Path, recursive: Boolean): Boolean = { + assert(fs.isDirectory(directory)) + val listStatus = fs.listStatus(directory) + if (listStatus.isEmpty) { + true + } else { + val result = listStatus.map { f => --- End diff -- what about `forall`?
--- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org