Skip to content

Inconsistent in table name encoding. #2462

@ianton-ru

Description

@ianton-ru

Apache Iceberg version

0.9.1 (latest release)

Please describe the bug 🐞

I tried to create a table with a slash character in its name, using Spark Iceberg as the catalog.

This code fails:

catalog = load_catalog(
    "rest",
    **{
        "type": "rest",
.........
    }
)

table =  catalog.create_table(
    identifier="foo/bar",
    ....
)

table.append(data)

with the following error:

requests.exceptions.HTTPError: 400 Client Error: Bad Request for url: http://localhost:8182/v1/namespaces/iceberg/tables/foo/bar
...
pyiceberg.exceptions.BadRequestError: BadRequestException: No route for request: POST v1/namespaces/iceberg/tables/foo/bar

This also fails:

table =  catalog.create_table(
    identifier="foo%2Fbar",
    ....
)

table.append(data)

with a different error:

requests.exceptions.HTTPError: 404 Client Error: Not Found for url: http://localhost:8182/v1/namespaces/iceberg/tables/foo%2Fbar
...
pyiceberg.exceptions.RESTError: NoSuchTableException: Table does not exist: iceberg.foo/bar

But if create using the non-encoded version, but load using the encoded one:

catalog.create_table(
    identifier="foo/bar",
    ....
)

table = catalog.load_table("foo%2Fbar")

table.append(data)

This works.

I don't think that this is correct behavior.

I would expect one of the following instead:

  1. Always use encoded name foo%2Fbar.
  2. Always use non-encoded name foo/bar.
  3. Restrict the use of "dangerous" characters in table names, including the slash.

I’m not sure which option is best, but the current behavior seems worse than any of them.

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions