dennishuo commented on code in PR #10877:
URL: https://github.com/apache/iceberg/pull/10877#discussion_r2586057597


##########
core/src/main/java/org/apache/iceberg/rest/RESTUtil.java:
##########
@@ -215,8 +232,32 @@ public static String encodeNamespace(Namespace ns) {
    * @return a namespace
    */
   public static Namespace decodeNamespace(String encodedNs) {
-    Preconditions.checkArgument(encodedNs != null, "Invalid namespace: null");
-    String[] levels = 
Iterables.toArray(NAMESPACE_ESCAPED_SPLITTER.split(encodedNs), String.class);
+    return decodeNamespace(encodedNs, NAMESPACE_ESCAPED_SEPARATOR);
+  }
+
+  /**
+   * Takes in a string representation of a namespace as used for a URL 
parameter and returns the
+   * corresponding namespace.
+   *
+   * <p>See also {@link #encodeNamespace} for generating correctly formatted 
URLs.
+   *
+   * @param encodedNamespace a namespace to decode
+   * @param separator The namespace separator to use for decoding. This should 
be the same separator

Review Comment:
   +1 to @snazy 's comment about digging a bit more into whether we're actually 
documenting what we intend to document in terms of whether something is before 
or after URL-encoding, and distinguish that from when we mean using the UTF-8 
charset encoding independently from URL-encoding.
   
   Probably what we want to document is that whatever the server *specifies* 
already needs to be valid UTF-8.
   
   *If* subsystems happen to ship those in an HTTP URL, they will URLEncode as 
necessary after interpreting the bytes as UTF-8, but the URLEncoding should 
otherwise be hidden from most callsites.



-- 
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.

To unsubscribe, e-mail: [email protected]

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