Github user tdas commented on a diff in the pull request:
https://github.com/apache/spark/pull/853#discussion_r13001368
--- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
@@ -1166,4 +1166,42 @@ private[spark] object Utils extends Logging {
true
}
}
+
+ /**
+ * Return a well-formed URI for the file described by a user input
string.
+ *
+ * If the supplied path does not contain a scheme, or is a relative
path, it will be
+ * converted into an absolute path with a file:// scheme.
+ */
+ def resolveURI(path: String, testWindows: Boolean = false): URI = {
+
+ val windows = isWindows || testWindows
+ // In Windows, the file separator is a backslash, but this is
inconsistent with the URI format
+ val formattedPath = if (windows) path.replace("\\", "/") else path
+ // Each Windows drive contains only a single alphabet character
+ val windowsDrive = "([a-zA-Z])".r
+
+ val uri = new URI(formattedPath)
+ uri.getScheme match {
--- End diff --
Also, I think, at least for local files, we can check early, in spark
submit whether that file exists or not.
---
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.
---