GCP: Fix listNamespaces to return empty list for existing namespaces
- Dominant language
- Java
- Stars
- 9.2k
- Forks
- 3.5k
- Avg merge
- 2d 16h
- Merged PRs (30d)
- 129
Description
**Apache Iceberg version**
main @ 035fc1e40
**Query engine**
N/A — catalog-level bug, engine-agnostic
**Please describe the bug**
`BigQueryMetastoreCatalog#listNamespaces(Namespace)` always throws `NoSuchNamespaceException` for any non-empty namespace argument, even when the namespace exists (bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreCatalog.java line 233-238, prior to fix).
This contradicts the method's own Javadoc: "Since this catalog only supports one-level namespaces, it always returns an empty list unless passed an empty namespace to list all namespaces within the catalog."
`HiveCatalog#listNamespaces(Namespace)` (hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java line 530-537) implements the correct pattern: check `namespaceExists(namespace)` first, return `ImmutableList.of()` if it exists, throw only if it does not.
**Steps to reproduce**
1. `catalog.createNamespace(Namespace.of("existing_ns"))`
2. `catalog.listNamespaces(Namespace.of("existing_ns"))`
Expected: empty list. Actual: `NoSuchNamespaceException`.
**Additional context**
N/A — covered above.
Contributor guide
Research direction
Start in bigquery/src/main/java/org/apache/iceberg/gcp/bigquery/BigQueryMetastoreCatalog.java at lines 233-238, then compare HiveCatalog#listNamespaces in hive-metastore/src/main/java/org/apache/iceberg/hive/HiveCatalog.java. Reproduce the listed createNamespace and listNamespaces calls; done means an existing non-empty namespace returns an empty list while a missing namespace still raises NoSuchNamespaceException.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- google-cloud, java
- Domain
- databases
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 82/100