Fokko commented on code in PR #2172:
URL: https://github.com/apache/iceberg-python/pull/2172#discussion_r2589627973


##########
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:
   I think it would be best not to use `iter` when not needed. In fact, we only 
need it for the list-tables of the REST Catalog. Does mypy allow to use `list` 
here? Same for line 748



-- 
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]

Reply via email to