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
19 changes: 8 additions & 11 deletions pyiceberg/manifest.py
Original file line number Diff line number Diff line change
Expand Up @@ -1087,18 +1087,15 @@ def add_entry(self, entry: ManifestEntry) -> ManifestWriter:
return self

def add(self, entry: ManifestEntry) -> ManifestWriter:
if entry.sequence_number is not None and entry.sequence_number >= 0:
self.add_entry(
ManifestEntry.from_args(
snapshot_id=self._snapshot_id, sequence_number=entry.sequence_number, data_file=entry.data_file
)
)
else:
self.add_entry(
ManifestEntry.from_args(
status=ManifestEntryStatus.ADDED, snapshot_id=self._snapshot_id, data_file=entry.data_file
)
self.add_entry(
ManifestEntry.from_args(
status=ManifestEntryStatus.ADDED,
snapshot_id=self._snapshot_id,
sequence_number=entry.sequence_number if entry.sequence_number != UNASSIGNED_SEQ else None,
data_file=entry.data_file,
)
)

return self

def delete(self, entry: ManifestEntry) -> ManifestWriter:
Expand Down
4 changes: 4 additions & 0 deletions tests/catalog/test_sql.py
Original file line number Diff line number Diff line change
Expand Up @@ -1657,6 +1657,10 @@ def test_merge_manifests_local_file_system(catalog: SqlCatalog, arrow_table_with
tbl.append(arrow_table_with_null)

assert len(tbl.scan().to_arrow()) == 5 * len(arrow_table_with_null)
current_snapshot = tbl.current_snapshot()
assert current_snapshot
manifests = current_snapshot.manifests(tbl.io)
assert len(manifests) == 1


@pytest.mark.parametrize(
Expand Down