diff --git a/pyiceberg/table/snapshots.py b/pyiceberg/table/snapshots.py index bf18a2b117..8d1a24c420 100644 --- a/pyiceberg/table/snapshots.py +++ b/pyiceberg/table/snapshots.py @@ -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: diff --git a/pyiceberg/table/update/validate.py b/pyiceberg/table/update/validate.py index 7caaf1d521..93cf12d669 100644 --- a/pyiceberg/table/update/validate.py +++ b/pyiceberg/table/update/validate.py @@ -23,8 +23,8 @@ 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]]: @@ -32,8 +32,8 @@ def validation_history( 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 @@ -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: diff --git a/tests/table/test_snapshots.py b/tests/table/test_snapshots.py index 2395ea7739..b71d92aa55 100644 --- a/tests/table/test_snapshots.py +++ b/tests/table/test_snapshots.py @@ -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, ) ) diff --git a/tests/table/test_validate.py b/tests/table/test_validate.py index eac3733f2d..ca7f83badd 100644 --- a/tests/table/test_validate.py +++ b/tests/table/test_validate.py @@ -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, ) @@ -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, ) @@ -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, )