[Bug] REST Catalog API does not work: org.apache.paimon.rest.exceptions.NoSuchResourceException
- Dominant language
- Java
- Stars
- 3.4k
- Forks
- 1.4k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 396
Description
### Search before asking
- [x] I searched in the [issues](https://github.com/apache/paimon/issues) and found nothing similar.
### Paimon version
1.3.1
### Compute Engine
Flink 2.1.1.
### Minimal reproduce step
using Paimon Java API, try to list tables in existing Iceberg REST catalog namespace:
```scala
//> using dep "org.apache.paimon:paimon-api:1.3.1"
import org.apache.paimon.options.Options
import org.apache.paimon.rest.RESTApi
import java.util.List
import org.apache.paimon.options.CatalogOptions.WAREHOUSE
import org.apache.paimon.rest.RESTCatalogOptions.DLF_ACCESS_KEY_ID
import org.apache.paimon.rest.RESTCatalogOptions.DLF_ACCESS_KEY_SECRET
import org.apache.paimon.rest.RESTCatalogOptions.TOKEN
import org.apache.paimon.rest.RESTCatalogOptions.TOKEN_PROVIDER
import org.apache.paimon.rest.RESTCatalogOptions.URI
def setBearToken(options: Options) =
options.set(TOKEN_PROVIDER, "bear")
options.set(TOKEN, "")
@main def testCatalog =
val options = Options()
options.set(URI, "http://your-url-here/iceberg/")
options.set(WAREHOUSE, "nessie_warehouse");
setBearToken(options)
val api = new RESTApi(options)
val tables = api.listTables("default")
println(tables)
```
REST requests reach my REST Catalog server, but I see it replies with 404 status
### What doesn't meet your expectations?
list tables should return empty list, but it fails with exception:
```scala
Exception in thread "main" org.apache.paimon.rest.exceptions.NoSuchResourceException:
at org.apache.paimon.rest.DefaultErrorHandler.accept(DefaultErrorHandler.java:62)
at org.apache.paimon.rest.DefaultErrorHandler.accept(DefaultErrorHandler.java:35)
at org.apache.paimon.rest.HttpClient.exec(HttpClient.java:156)
at org.apache.paimon.rest.HttpClient.get(HttpClient.java:81)
at org.apache.paimon.rest.RESTApi.lambda$listTables$1(RESTApi.java:328)
at org.apache.paimon.rest.RESTApi.listDataFromPageApi(RESTApi.java:1307)
at org.apache.paimon.rest.RESTApi.listTables(RESTApi.java:326)
at catalogTest$package$.testCatalog(catalogTest.scala:26)
at testCatalog.main(catalogTest.scala:19)
```
### Anything else?
It seems Paimon uses "databases" instead of "namespaces" concept.
https://iceberg.apache.org/javadoc/latest/org/apache/iceberg/rest/RESTCatalog.html#listNamespaces(org.apache.iceberg.catalog.Namespace)
### Are you willing to submit a PR?
- [ ] I'm willing to submit a PR!
Contributor guide
No contributing guide indexed for this repository
Research direction
Start with RESTApi.listTables at RESTApi.java:326 and its listDataFromPageApi path, then inspect DefaultErrorHandler.java:62 and HttpClient.java:156 while reproducing the 404 against an Iceberg REST catalog. Compare the database/namespace handling with the REST catalog behavior described in the issue. Done means listing an existing empty namespace returns an empty list instead of NoSuchResourceException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100