You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/07/22 16:34:14 UTC

[GitHub] [iceberg] aokolnychyi commented on a change in pull request #1228: Fix Handling of SparkPartitions with Whitepsace in Location

aokolnychyi commented on a change in pull request #1228:
URL: https://github.com/apache/iceberg/pull/1228#discussion_r458928543



##########
File path: spark/src/main/java/org/apache/iceberg/spark/SparkTableUtil.java
##########
@@ -386,7 +386,7 @@ private static SparkPartition toSparkPartition(CatalogTablePartition partition,
     Preconditions.checkArgument(serde.nonEmpty() || table.provider().nonEmpty(),
         "Partition format should be defined");
 
-    String uri = String.valueOf(locationUri.get());
+    URI uri = locationUri.get();

Review comment:
       Here what Spark does:
   
   ```
     /**
      * Convert URI to String.
      * Since URI.toString does not decode the uri, e.g. change '%25' to '%'.
      * Here we create a hadoop Path with the given URI, and rely on Path.toString
      * to decode the uri
      * @param uri the URI of the path
      * @return the String of the path
      */
     def URIToString(uri: URI): String = {
       new Path(uri).toString
     }
   
     /**
      * Convert String to URI.
      * Since new URI(string) does not encode string, e.g. change '%' to '%25'.
      * Here we create a hadoop Path with the given String, and rely on Path.toUri
      * to encode the string
      * @param str the String of the path
      * @return the URI of the path
      */
     def stringToURI(str: String): URI = {
       new Path(str).toUri
     }
   ```




----------------------------------------------------------------
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:
users@infra.apache.org



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org