Github user aarondav commented on a diff in the pull request:

    https://github.com/apache/spark/pull/3293#discussion_r20419311
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -759,18 +759,9 @@ private[spark] object Utils extends Logging {
         if (file != null) {
           try {
             if (file.isDirectory && !isSymlink(file)) {
    -          var savedIOException: IOException = null
    -          for (child <- listFilesSafely(file)) {
    -            try {
    -              deleteRecursively(child)
    -            } catch {
    -              // In case of multiple exceptions, only last one will be 
thrown
    -              case ioe: IOException => savedIOException = ioe
    -            }
    -          }
    -          if (savedIOException != null) {
    -            throw savedIOException
    -          }
    +          listFilesSafely(file).map(child => 
Try(deleteRecursively(child))).
    --- End diff --
    
    Your point about the for comprehension is incorrect in that, without a 
`yield`, it actually turns into a foreach, which expands lazy iterators:
    
    `for (i <- Iterator(1, 2,3) { println(i) }`
    
    works as expected.


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

Reply via email to