Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,7 @@ def snapshot_id(self) -> int | None:

@snapshot_id.setter
def snapshot_id(self, value: int) -> None:
self._data[0] = value
self._data[1] = value

@property
def sequence_number(self) -> int | None:
Expand Down
41 changes: 41 additions & 0 deletions tests/utils/test_manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
ManifestEntryStatus,
ManifestFile,
PartitionFieldSummary,
_inherit_from_manifest,
_manifest_cache,
_manifests,
read_manifest_list,
Expand Down Expand Up @@ -932,3 +933,43 @@ def test_manifest_writer_tell(format_version: TableVersion) -> None:
after_entry_bytes = writer.tell()

assert after_entry_bytes > initial_bytes, "Bytes should increase after adding entry"


def test_inherit_from_manifest_snapshot_id() -> None:
entry = ManifestEntry.from_args(
status=ManifestEntryStatus.ADDED,
snapshot_id=None,
sequence_number=None,
file_sequence_number=None,
data_file=DataFile.from_args(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: the tests here use the file_format=FileFormat.PARQUET for the enum and partition is set with partition=Record() when constructing a Datafile.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed, thank you!

content=DataFileContent.DATA,
file_path="s3://bucket/data/file.parquet",
file_format="PARQUET",
partition={},
record_count=100,
file_size_in_bytes=1024,
),
)

manifest = ManifestFile.from_args(
manifest_path="s3://bucket/metadata/manifest.avro",
manifest_length=1000,
partition_spec_id=0,
content=ManifestContent.DATA,
sequence_number=1,
min_sequence_number=1,
added_snapshot_id=3051729675574597004,
added_files_count=1,
existing_files_count=0,
deleted_files_count=0,
added_rows_count=100,
existing_rows_count=0,
deleted_rows_count=0,
)

result = _inherit_from_manifest(entry, manifest)

assert result.status == ManifestEntryStatus.ADDED
assert result.snapshot_id == 3051729675574597004
assert result.sequence_number == 1
assert result.file_sequence_number == 1
Loading