Github user vanzin commented on a diff in the pull request:
https://github.com/apache/spark/pull/4880#discussion_r25741212
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -643,7 +645,12 @@ private[spark] object Utils extends Logging {
fileOverwrite)
} else {
val in = fs.open(innerPath)
- val targetFile = new File(targetDir, innerPath.getName)
+ val targetFile: File =
+ if (!filename.isEmpty) {
+ new File(targetDir, filename)
+ } else {
+ new File(targetDir, innerPath.getName)
+ }
--- End diff --
I think it's a little weird but it works. Only the very first call to
`fetchHcfsFile` defines `filename`. If the `path` passed to it is a directory,
it will recursively call itself without setting `filename`. If it's a file, it
will write the file using the given `filename`. So even if it could be clearer,
the code as is should work.
But I'm ok with making it clearer, exactly to avoid this kind of
discussion. :-)
---
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]