Skip to content

Commit f2f3a88

Browse files
committed
correct ancestors_between
1 parent c63cc55 commit f2f3a88

1 file changed

Lines changed: 9 additions & 5 deletions

File tree

pyiceberg/table/snapshots.py

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -432,10 +432,14 @@ def ancestors_of(current_snapshot: Optional[Snapshot], table_metadata: TableMeta
432432

433433

434434
def ancestors_between(
435-
current_snapshot: Optional[Snapshot], oldest_snapshot: Snapshot, table_metadata: TableMetadata
435+
current_snapshot: Snapshot, oldest_snapshot: Optional[Snapshot], table_metadata: TableMetadata
436436
) -> Iterable[Snapshot]:
437437
"""Get the ancestors of and including the given snapshot between the latest and oldest snapshot."""
438-
for snapshot in ancestors_of(current_snapshot, table_metadata):
439-
if snapshot.snapshot_id == oldest_snapshot.snapshot_id:
440-
break
441-
yield snapshot
438+
if oldest_snapshot is not None:
439+
for snapshot in ancestors_of(current_snapshot, table_metadata):
440+
if snapshot.snapshot_id == oldest_snapshot.snapshot_id:
441+
break
442+
yield snapshot
443+
else:
444+
for snapshot in ancestors_of(current_snapshot, table_metadata):
445+
yield snapshot

0 commit comments

Comments
 (0)