Skip to content

Conversation

@rambleraptor
Copy link
Contributor

Rationale for this change

There's a couple missing catalog tests around supporting namespaces + tables with slashes/dots. Along the way, I found an issue in how we create the CreateTableRequest + RegisterTableRequest

Are these changes tested?

Tests are included.

Are there any user-facing changes?

@rambleraptor rambleraptor marked this pull request as ready for review January 26, 2026 22:59
Comment on lines +641 to +646
def _namespace_exists(catalog: Catalog, namespace: str | Identifier) -> bool:
try:
catalog.load_namespace_properties(namespace)
return True
except NoSuchNamespaceError:
return False
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just add namespace_exists to all the catalog implementations?
similar to the one in the rest catalog,

@retry(**_RETRY_ARGS)
def namespace_exists(self, namespace: str | Identifier) -> bool:
namespace_tuple = self._check_valid_namespace_identifier(namespace)
namespace = self._encode_namespace_path(namespace_tuple)
# fallback in order to work with older rest catalog implementations
if Capability.V1_NAMESPACE_EXISTS not in self._supported_endpoints:
try:
self.load_namespace_properties(namespace_tuple)
return True
except NoSuchNamespaceError:
return False
response = self._session.head(self.url(Endpoints.namespace_exists, namespace=namespace))
if response.status_code == 404:
return False
elif response.status_code in (200, 204):
return True
try:
response.raise_for_status()
except HTTPError as exc:
_handle_non_200_response(exc, {})
return False

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, I agree 100% with this. I created #2969. I can make a separate PR, but I feel like it'll potentially muddy this one to add it here. How does that sound?

Comment on lines 688 to 693
# list_namespaces returns a list of tuples
if isinstance(test_catalog, RestCatalog):
namespaces = test_catalog.list_namespaces()
assert ("new",) in namespaces or ("new.db",) in namespaces
else:
assert namespace in test_catalog.list_namespaces()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do you know why theres a behavior difference here?
ideally we're testing for consistent catalog behaviors in this class

Copy link
Contributor Author

@rambleraptor rambleraptor Jan 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't think of this as an actual issue, but maybe it is.

Calling list namespaces would get you:

rest_catalog - new
others - new.db

That's because iceberg-rest-fixture treats this as hierarchical namespaces, which many other catalogs don't support. The spec supports hierarchical namespaces, so that seems to be working as intended.

My comment was very poor, so I wrote an actual comment to explain this.

@jayceslesar
Copy link
Contributor

Nice!

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.

3 participants