Github user pwendell commented on a diff in the pull request:
https://github.com/apache/spark/pull/853#discussion_r12987475
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -1166,4 +1166,35 @@ private[spark] object Utils extends Logging {
true
}
}
+
+ /** Return the URI of the input path. If a relative path is given,
assume it is local. */
+ def resolveURI(path: String, testWindows: Boolean = false): URI = {
+
+ // On Windows, file names cannot contain backslashes and colons,
+ // and each drive contains only a single alphabet character
+ val windows = isWindows || testWindows
+ val sanitizedPath = if (windows) path.replace("\\", "/") else path
+ val windowsDrive = "([a-zA-Z])".r
+
+ val uri = new URI(sanitizedPath)
+ uri.getScheme match {
+ case windowsDrive(d) if windows =>
+ new URI("file:/" + uri.toString.stripPrefix("/"))
+ case null =>
+ val fragment = uri.getFragment
--- End diff --
It would be good to document that we preserve the fragment because it has a
special meaning for YARN URI's.
---
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.
---