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

    https://github.com/apache/spark/pull/14960#discussion_r77574745
  
    --- Diff: core/src/main/scala/org/apache/spark/util/Utils.scala ---
    @@ -1900,7 +1900,20 @@ private[spark] object Utils extends Logging {
        */
       def resolveURI(path: String): URI = {
         try {
    -      val uri = new URI(path)
    +      val osSafePath = if (Path.isWindowsAbsolutePath(path, false)) {
    +        // Make sure C:/ part becomes /C/.
    +        val windowsUri = new URI(path)
    +        val driveLetter = windowsUri.getScheme
    +        s"/$driveLetter/${windowsUri.getSchemeSpecificPart()}"
    +      } else if (Path.isWindowsAbsolutePath(path, true)) {
    +        // Make sure /C:/ part becomes /C/.
    +        val windowsUri = new URI(path.substring(1))
    +        val driveLetter = windowsUri.getScheme
    +        s"/$driveLetter/${windowsUri.getSchemeSpecificPart()}"
    --- End diff --
    
    Let me please just use `new Path(...).toUri` directly to deal with this if 
it seems okay.
    
    I just tried to fix `resolveURI` to use `new Path(path).toUri` instead of 
`new URI(path)` but I found it breaks existing tests for `resolveURI`. It seems 
parsing special characters differently, for example , `#`
    
    ```
    "hdfs:/root/spark.jar[%23]app.jar" did not equal 
"hdfs:/root/spark.jar[#]app.jar"
    ```
    



---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to