HonahX commented on code in PR #787:
URL: https://github.com/apache/iceberg-python/pull/787#discussion_r1625475590


##########
pyiceberg/table/snapshots.py:
##########
@@ -247,9 +248,12 @@ def __str__(self) -> str:
         result_str = f"{operation}id={self.snapshot_id}{parent_id}{schema_id}"
         return result_str
 
-    def manifests(self, io: FileIO) -> List[ManifestFile]:
-        if self.manifest_list is not None:
-            file = io.new_input(self.manifest_list)
+    @staticmethod
+    @lru_cache
+    def manifests(io: FileIO, manifest_list: str) -> List[ManifestFile]:
+        """Return the manifests for the given snapshot."""
+        if manifest_list not in (None, ""):
+            file = io.new_input(manifest_list)

Review Comment:
   How about keeping the original interface while adding a helper that using 
lru_cache?
   ```python
       @staticmethod
       @lru_cache
       def _manifests(io: FileIO, manifest_list: Optional[str]) -> 
List[ManifestFile]:
           if manifest_list not in (None, ""):
               file = io.new_input(manifest_list)
               return list(read_manifest_list(file))
           return []
   
       def manifests(self, io: FileIO) -> List[ManifestFile]:
           return Snapshot._manifests(io, self.manifest_list)
   ```
   Adding an additional argument breaks the public API. 



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to