Github user ryan-williams commented on the pull request:
https://github.com/apache/spark/pull/2848#issuecomment-62165292
OK, I refactored a little further. Updates:
* renamed the helper function `maybeMoveFile` (instead of `moveFile`)
* introduced a second signature for `maybeMoveFile` that just takes two
`File`s
* this allowed me to bring the 3rd instance of this repeated logic in
`Utils.doFetchFile` into the fold, which helps the overall consistency /
cleanliness a lot, I think.
* incidentally, that last code path handled the `exists` vs. `delete()`
trickery differently than I was doing before; it used a boolean `var` that
recorded explicitly whether we `shouldCopy` (`true` to start, set to `false`
iff we found an identical file to exist). I decided that this way was cleaner,
per @andrewor14's and @pwendell's (earlier in this thread) suggestions, and
structured `maybeMoveFile` that way.
* folded the code path around L397 into `maybeMoveFile` as well, per
@andrewor14's last suggestion.
lmk how it looks!
---
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]