GCP: Fix listNamespaces to return empty list for existing namespaces

Open Beginner friendly
#17,058 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
82/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Quiet
Tech stack
google-cloud, java
Domain
databases

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.

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.

Dominant language
Java
Stars
9.3k
Forks
3.5k
Avg merge
2d 11h
Merged PRs (30d)
143

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/iceberg

All issues in apache/iceberg

Similar issues

More Java issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.