Skip to content

Incorrect Output from list_namespaces in SqlCatalog #1627

@alessandro-nori

Description

@alessandro-nori

Apache Iceberg version

main (development)

Please describe the bug 🐞

When a namespace is provided as a parameter, SqlCatalog.list_namespaces(namespace) returns the namespace itself.

>>> import pyiceberg
>>> pyiceberg.__version__
'0.9.0'
>>> from pyiceberg.catalog.sql import SqlCatalog
>>> catalog = SqlCatalog("example", **{"uri":"sqlite:///:memory:", "warehouse":"/tmp/pyiceberg/warehouse"})
>>> catalog.list_namespaces()
[]
>>> catalog.create_namespace("ns1.ns2")
>>> catalog.create_namespace("ns1.ns2.ns3")
>>> catalog.list_namespaces()
[('ns1', 'ns2'), ('ns1', 'ns2', 'ns3')]
>>> catalog.create_namespace("ns1")
>>> catalog.list_namespaces()
[('ns1',), ('ns1', 'ns2'), ('ns1', 'ns2', 'ns3')]
>>> catalog.list_namespaces("ns1")
[('ns1',)]

Expected behavior

Similar to other catalog implementations, calling list_namespaces with a namespace as a parameter should return only the sub-namespaces, excluding the namespace itself.

e.g. for other python catalogs

And the for the JdbcCatalog in Java:

Willingness to contribute

  • I can contribute a fix for this bug independently
  • I would be willing to contribute a fix for this bug with guidance from the Iceberg community
  • I cannot contribute a fix for this bug at this time

Metadata

Metadata

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions