Skip to content

GCP: Fix listNamespaces to return empty list for existing namespaces#17060

Open
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/bigquery-listnamespaces-existing-namespace
Open

GCP: Fix listNamespaces to return empty list for existing namespaces#17060
thswlsqls wants to merge 1 commit into
apache:mainfrom
thswlsqls:fix/bigquery-listnamespaces-existing-namespace

Conversation

@thswlsqls

Copy link
Copy Markdown
Contributor

Closes #17058

Summary

  • listNamespaces(Namespace) threw NoSuchNamespaceException for any non-empty namespace, even existing ones, contradicting its own Javadoc ("always returns an empty list" for an existing single-level namespace).
  • Now checks namespaceExists(namespace): returns ImmutableList.of() if it exists, throws only if it does not.
  • Matches HiveCatalog#listNamespaces(Namespace) (hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java line 530-537), which uses the same existence-check-then-throw pattern.

Testing done

  • Added TestBigQueryCatalog#testListNamespacesWithExistingNamespaceReturnsEmptyList covering the existing-namespace case.
  • ./gradlew :iceberg-bigquery:check — 110 tests, 0 failures, 0 errors (23 skipped, pre-existing @Disabled cases unrelated to this change).

listNamespaces(Namespace) always threw NoSuchNamespaceException for any
non-empty argument, even when the namespace existed. This contradicted the
method's own Javadoc, which says an existing single-level namespace returns
an empty list (BigQuery only supports one-level namespaces, so no
sub-namespaces exist). Check namespaceExists(namespace) before throwing,
mirroring HiveCatalog#listNamespaces(Namespace).

Generated-by: Claude Code
@github-actions github-actions Bot added the GCP label Jul 3, 2026

@ebyhr ebyhr left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

This introduces an additional datasets.get RPC call, but I believe this change is reasonable.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

GCP: Fix listNamespaces to return empty list for existing namespaces

2 participants