Github user JoshRosen commented on a diff in the pull request:
https://github.com/apache/spark/pull/3670#discussion_r23971392
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -513,13 +516,44 @@ private[spark] object Utils extends Logging {
Files.move(sourceFile, destFile)
} else {
logInfo(s"Copying ${sourceFile.getAbsolutePath} to
${destFile.getAbsolutePath}")
- Files.copy(sourceFile, destFile)
+ copyRecursive(sourceFile, destFile)
+ }
+ }
+
+ private def filesEqualRecursive(file1: File, file2: File): Boolean = {
+ if (file1.isDirectory && file2.isDirectory) {
+ val subfiles1 = file1.listFiles()
+ val subfiles2 = file2.listFiles()
+ if (subfiles1.size != subfiles2.size) {
+ return false
+ }
+
subfiles1.sortBy(_.getName).zip(subfiles2.sortBy(_.getName)).dropWhile {
--- End diff --
Instead of `dropWhile { ... }.isEmpty`, I think you can do `forAll`:
```scala
scala> Seq(1, 2, 3).forall { _ >= 3 }
res1: Boolean = false
scala> Seq(1, 2, 3).forall { _ >= 0 }
res2: Boolean = true
```
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]