Skip to content

[Bug] REST Catalog API does not work: org.apache.paimon.rest.exceptions.NoSuchResourceException #6908

@novakov-alexey

Description

@novakov-alexey

Search before asking

  • I searched in the 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:

//> 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, "<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:

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions