jayceslesar commented on code in PR #2172:
URL: https://github.com/apache/iceberg-python/pull/2172#discussion_r2590698974
##########
pyiceberg/catalog/hive.py:
##########
@@ -719,33 +720,33 @@ def list_tables(self, namespace: str | Identifier) ->
list[Identifier]:
namespace: Database to list.
Returns:
- List[Identifier]: list of table identifiers.
+ Iterator[Identifier]: iterator of table identifiers.
Raises:
NoSuchNamespaceError: If a namespace with the given name does not
exist, or the identifier is invalid.
"""
database_name = self.identifier_to_database(namespace,
NoSuchNamespaceError)
with self._client as open_client:
- return [
+ yield from [
(database_name, table.tableName)
for table in open_client.get_table_objects_by_name(
dbname=database_name,
tbl_names=open_client.get_all_tables(db_name=database_name)
)
if table.parameters.get(TABLE_TYPE, "").lower() == ICEBERG
]
- def list_namespaces(self, namespace: str | Identifier = ()) ->
list[Identifier]:
+ def list_namespaces(self, namespace: str | Identifier = ()) ->
Iterator[Identifier]:
"""List namespaces from the given namespace. If not given, list
top-level namespaces from the catalog.
Returns:
- List[Identifier]: a List of namespace identifiers.
+ Iterator[Identifier]: an iterator of namespace identifiers.
"""
# Hierarchical namespace is not supported. Return an empty list
if namespace:
- return []
+ return iter([])
Review Comment:
mypy says
```
pyiceberg/catalog/hive.py:746: error: Incompatible return value type (got
"list[Never]", expected "Iterator[tuple[str, ...]]") [return-value]
pyiceberg/catalog/hive.py:746: note: "list" is missing following
"Iterator" protocol member:
pyiceberg/catalog/hive.py:746: note: __next__
Found 1 error in 1 file (checked 166 source files)
```
--
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]