alessandro-nori commented on code in PR #1629:
URL: https://github.com/apache/iceberg-python/pull/1629#discussion_r1954139234
##########
pyiceberg/catalog/sql.py:
##########
@@ -610,15 +610,26 @@ def list_namespaces(self, namespace: Union[str,
Identifier] = ()) -> List[Identi
table_stmt =
select(IcebergTables.table_namespace).where(IcebergTables.catalog_name ==
self.name)
namespace_stmt =
select(IcebergNamespaceProperties.namespace).where(IcebergNamespaceProperties.catalog_name
== self.name)
if namespace:
- namespace_str = Catalog.namespace_to_string(namespace,
NoSuchNamespaceError)
- table_stmt =
table_stmt.where(IcebergTables.table_namespace.like(namespace_str))
- namespace_stmt =
namespace_stmt.where(IcebergNamespaceProperties.namespace.like(namespace_str))
+ namespace_like = Catalog.namespace_to_string(namespace,
NoSuchNamespaceError) + "%"
Review Comment:
let's assume `foo.bar` namespace exists.
If I call `list_namespaces("foo")` I should get [("foo", "bar")] in the
result so my query should look like:
`SELECT .... FROM ... WHERE table_namespace LIKE 'foo%'` and not
`SELECT .... FROM ... WHERE table_namespace LIKE 'foo'`.
JdbcCatalog also adds `%`.
Source:
https://github.com/apache/iceberg/blob/746e71931a35e83726852a60d7ca8cb6065e334f/core/src/main/java/org/apache/iceberg/jdbc/JdbcCatalog.java#L448
https://github.com/apache/iceberg/blob/472ec6cbdcaa24773ef5c64c9444ae933805381d/core/src/main/java/org/apache/iceberg/jdbc/JdbcUtil.java#L345-L354
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]