blinkseb opened a new issue, #7116:
URL: https://github.com/apache/gravitino/issues/7116

   ### Version
   
   main branch
   
   ### Describe what's wrong
   
   Hello!
   
   I'm currently checking if Gravitino Iceberg REST catalog would be suitable 
for us in order to replace an existing JDBC catalog. However, it seems that 
support for nested namespaces is not working correctly.
   
   I have an existing namespace `test`, which contains a namespace `namespace`.
   
   Using `pyiceberg` to list the `test` namespace works as expected:
   
   ```
   uvx pyiceberg@latest --catalog rest --uri http://localhost:9001/iceberg/ 
list test
   test.namespace
   ```
   
   But listing the content of `test.namespace` does not work:
   
   ```
   uvx pyiceberg@latest --catalog rest --uri http://localhost:9001/iceberg/ 
list test.namespace
   NoSuchNamespaceException: Namespace does not exist: testnamespace
   ```
   
   notice the \u001F character: it's the character that's used in the REST 
protocol as namespace separator.
   
   I'll looked a bit at the code, and I see that namespaces are decoded using 
[`RESTUtil.decodeNamespace` from 
Iceberg]([here](https://github.com/apache/iceberg/blob/apache-iceberg-1.5.2/core/src/main/java/org/apache/iceberg/rest/RESTUtil.java#L207-L217)
 
(https://github.com/apache/gravitino/blob/main/iceberg/iceberg-rest-server/src/main/java/org/apache/gravitino/iceberg/service/rest/IcebergTableOperations.java#L93)
 for example), which split the string on the `%1F` string separator. Thus this 
method expects an url-encoded string. My guess is that the input string was 
already url-decoded before calling `decodeNamespace`.
   
   Using curl, I double encoded the query parameter (`test%1Fnamespace` -> 
`test%251namespace`), and it works:
   
   ```
   curl 'http://localhost:9001/iceberg/v1/namespaces?parent=test%251Fnamespace'
   {"namespaces":[]}
   ```
   
   vs the standard call:
   
   ```
   curl 'http://localhost:9001/iceberg/v1/namespaces?parent=test%1Fnamespace'
   {"error":{"message":"Namespace does not exist: 
test\u001Fnamespace","type":"NoSuchNamespaceException","code":404,"stack": []}
   ```
   
   Thanks a lot for your help!
   
   ### Error message and/or stacktrace
   
   ```
   exception: class org.apache.iceberg.exceptions.NoSuchNamespaceException, 
exception message: Namespace does not exist: testnamespace
   ```
   
   ### How to reproduce
   
   running
   
   ```
   curl 'http://localhost:9001/iceberg/v1/namespaces?parent=test%1Fnamespace'
   ```
   
   is enough.
   
   I'm using v`0.8.1-incubating`.
   
   
   ### Additional context
   
   _No response_


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

Reply via email to