southernriver commented on pull request #30707:
URL: https://github.com/apache/spark/pull/30707#issuecomment-742931418


   > Doesn't that space have to be escaped in the URI?
   
   The  `hdfs://ns1/tmp2/ 2020` is a full location path. 
   When constructed a path from  URI as below:
   ```
     /**
      * Construct a path from a URI
      */
     public Path(URI aUri) {
       uri = aUri.normalize();
     }
   ```
   ```
      /**
        * @param  str   The string to be parsed into a URI
        *
        * @throws  NullPointerException
        *          If {@code str} is {@code null}
        *
        * @throws  URISyntaxException
        *          If the given string violates RFC 2396, as augmented
        *          by the above deviations
        */
       public URI(String str) throws URISyntaxException {
           new Parser(str).parse(false);
       }
   ```
   `java.net.URISyntaxException`  would be throwed .
   And then we can fall back to construct a path from a full location which 
contains space.
   ```
   /** Construct a path from a String.  Path strings are URIs, but with
      * unescaped elements and some additional normalization. */
     public Path(String pathString) throws IllegalArgumentException {
       checkPathArg( pathString );
   ```
   
   
   


----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to