Skip to content

Commit 6d60d41

Browse files
committed
Fix legacy manifest test expectations
Exclude V3-only properties from V1 and V2 fastavro comparisons and clarify the latest read-version constant name.
1 parent 44312bd commit 6d60d41

2 files changed

Lines changed: 10 additions & 4 deletions

File tree

pyiceberg/manifest.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@
5656
UNASSIGNED_SEQ = -1
5757
DEFAULT_BLOCK_SIZE = 67108864 # 64 * 1024 * 1024
5858
DEFAULT_READ_VERSION: Literal[2] = 2
59-
_LATEST_MANIFEST_VERSION: Literal[3] = 3
59+
_LATEST_MANIFEST_READ_VERSION: Literal[3] = 3
6060

6161
INITIAL_SEQUENCE_NUMBER = 0
6262

@@ -894,7 +894,7 @@ def fetch_manifest_entry(self, io: FileIO, discard_deleted: bool = True) -> list
894894
input_file = io.new_input(self.manifest_path)
895895
with AvroFile[ManifestEntry](
896896
input_file,
897-
MANIFEST_ENTRY_SCHEMAS[_LATEST_MANIFEST_VERSION],
897+
MANIFEST_ENTRY_SCHEMAS[_LATEST_MANIFEST_READ_VERSION],
898898
read_types={-1: ManifestEntry, 2: DataFile},
899899
read_enums={0: ManifestEntryStatus, 101: FileFormat, 134: DataFileContent},
900900
) as reader:
@@ -1017,7 +1017,7 @@ def read_manifest_list(input_file: InputFile) -> Iterator[ManifestFile]:
10171017
"""
10181018
with AvroFile[ManifestFile](
10191019
input_file,
1020-
MANIFEST_LIST_FILE_SCHEMAS[_LATEST_MANIFEST_VERSION],
1020+
MANIFEST_LIST_FILE_SCHEMAS[_LATEST_MANIFEST_READ_VERSION],
10211021
read_types={-1: ManifestFile, 508: PartitionFieldSummary},
10221022
read_enums={517: ManifestContent},
10231023
) as reader:

tests/avro/test_file.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,6 +164,8 @@ def test_write_manifest_entry_with_iceberg_read_with_fastavro_v1() -> None:
164164
del v2_entry["file_sequence_number"]
165165
del v2_entry["data_file"]["content"]
166166
del v2_entry["data_file"]["equality_ids"]
167+
for field in ("first_row_id", "referenced_data_file", "content_offset", "content_size_in_bytes"):
168+
del v2_entry["data_file"][field]
167169

168170
# Required in V1
169171
v2_entry["data_file"]["block_size_in_bytes"] = DEFAULT_BLOCK_SIZE
@@ -222,7 +224,11 @@ def test_write_manifest_entry_with_iceberg_read_with_fastavro_v2() -> None:
222224

223225
fa_entry = next(it)
224226

225-
assert todict(entry) == fa_entry
227+
v2_entry = todict(entry)
228+
for field in ("first_row_id", "referenced_data_file", "content_offset", "content_size_in_bytes"):
229+
del v2_entry["data_file"][field]
230+
231+
assert v2_entry == fa_entry
226232

227233

228234
@pytest.mark.parametrize("format_version", [1, 2])

0 commit comments

Comments
 (0)