Skip to content

Conversation

@karunmotorq
Copy link

Summary

This PR fixes an issue where tables in hierarchical/nested Iceberg namespaces are not discoverable when using the REST catalog (e.g., Snowflake Polaris).

Problem

When querying tables in nested namespaces like teslasource.kafkav6.source-data, ClickHouse constructs the URL path incorrectly:

❌ Current:  /namespaces/teslasource.kafkav6/tables
✅ Expected: /namespaces/teslasource%1Fkafkav6/tables

According to the Iceberg REST Catalog OpenAPI spec, multi-level namespaces should be joined with the unit separator character (0x1F) which is URL-encoded as %1F.

The current implementation uses a dot (.) separator, causing the Polaris API to return:

{"error":{"message":"Namespace does not exist: teslasource.kafkav6","type":"NoSuchNamespaceException","code":404}}

Changes

  1. Added encodeNamespaceForURI() function that replaces . with %1F in namespace paths
  2. Applied encoding in getTables() when constructing the tables endpoint
  3. Applied encoding in getTableMetadataImpl() when constructing the table metadata endpoint

Testing

Tested with Snowflake Polaris catalog containing 117 tables across 15 namespaces with nested sub-namespaces (e.g., azugasource.kafkav2, teslasource.kafkav6).

Before fix: SHOW TABLES returns 0 tables (all 404 errors in logs)
After fix: Tables in nested namespaces are discoverable

Related

Add encodeNamespaceForURI function to properly encode multi-level
namespaces using the unit separator (%1F) as required by the Iceberg
REST Catalog API specification.

This fixes the issue where tables in nested namespaces (e.g.,
teslasource.kafkav6.source-data) were not discoverable because
ClickHouse was using dot separators in the URL path instead of %1F.

Fixes: Tables in hierarchical namespaces return 404 errors
Reference: https://github.com/apache/iceberg/blob/main/open-api/rest-catalog-open-api.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant