Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyiceberg/table/snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -438,7 +438,7 @@ def ancestors_of(current_snapshot: Optional[Snapshot], table_metadata: TableMeta


def ancestors_between(
to_snapshot: Snapshot, from_snapshot: Optional[Snapshot], table_metadata: TableMetadata
from_snapshot: Optional[Snapshot], to_snapshot: Snapshot, table_metadata: TableMetadata
) -> Iterable[Snapshot]:
"""Get the ancestors of and including the given snapshot between the to and from snapshots."""
if from_snapshot is not None:
Expand Down
6 changes: 3 additions & 3 deletions pyiceberg/table/update/validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,17 +23,17 @@

def validation_history(
table: Table,
to_snapshot: Snapshot,
from_snapshot: Snapshot,
to_snapshot: Snapshot,
matching_operations: set[Operation],
manifest_content_filter: ManifestContent,
) -> tuple[list[ManifestFile], set[int]]:
"""Return newly added manifests and snapshot IDs between the starting snapshot and parent snapshot.

Args:
table: Table to get the history from
to_snapshot: Starting snapshot
from_snapshot: Parent snapshot to get the history from
to_snapshot: Starting snapshot
matching_operations: Operations to match on
manifest_content_filter: Manifest content type to filter

Expand All @@ -47,7 +47,7 @@ def validation_history(
snapshots: set[int] = set()

last_snapshot = None
for snapshot in ancestors_between(to_snapshot, from_snapshot, table.metadata):
for snapshot in ancestors_between(from_snapshot, to_snapshot, table.metadata):
last_snapshot = snapshot
summary = snapshot.summary
if summary is None:
Expand Down
2 changes: 1 addition & 1 deletion tests/table/test_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -426,8 +426,8 @@ def test_ancestors_between(table_v2_with_extensive_snapshots: Table) -> None:
len(
list(
ancestors_between(
current_snapshot,
oldest_snapshot,
current_snapshot,
table_v2_with_extensive_snapshots.metadata,
)
)
Expand Down
6 changes: 3 additions & 3 deletions tests/table/test_validate.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,8 +71,8 @@ def mock_read_manifest_side_effect(self: Snapshot, io: FileIO) -> list[ManifestF
with patch("pyiceberg.table.snapshots.Snapshot.manifests", new=mock_read_manifest_side_effect):
manifests, snapshots = validation_history(
table,
newest_snapshot,
oldest_snapshot,
newest_snapshot,
{Operation.APPEND},
ManifestContent.DATA,
)
Expand Down Expand Up @@ -101,8 +101,8 @@ def test_validation_history_fails_on_snapshot_with_no_summary(
with pytest.raises(ValidationException):
validation_history(
table,
newest_snapshot,
oldest_snapshot,
newest_snapshot,
{Operation.APPEND},
ManifestContent.DATA,
)
Expand Down Expand Up @@ -131,8 +131,8 @@ def mock_read_manifest_side_effect(self: Snapshot, io: FileIO) -> list[ManifestF
with pytest.raises(ValidationException):
validation_history(
table,
newest_snapshot,
oldest_snapshot,
newest_snapshot,
{Operation.APPEND},
ManifestContent.DATA,
)