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


##########
pyiceberg/table/snapshots.py:
##########
@@ -421,8 +421,16 @@ def set_when_positive(properties: Dict[str, str], num: 
int, property_name: str)
 
 def ancestors_of(current_snapshot: Optional[Snapshot], table_metadata: 
TableMetadata) -> Iterable[Snapshot]:
     """Get the ancestors of and including the given snapshot."""
-    if current_snapshot:
-        yield current_snapshot
-        if current_snapshot.parent_snapshot_id is not None:
-            if parent := 
table_metadata.snapshot_by_id(current_snapshot.parent_snapshot_id):
-                yield from ancestors_of(parent, table_metadata)
+    seen = set()

Review Comment:
   Out of curiosity, why do we need to track the seen ones? The metadata should 
be a tree, and not a graph (no cycles)



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