This is an automated email from the ASF dual-hosted git repository. fokko pushed a commit to branch main in repository https://gitbox.apache.org/repos/asf/iceberg-python.git
The following commit(s) were added to refs/heads/main by this push: new 7acdb12f Set the ManifestEntryStatus (#2408) 7acdb12f is described below commit 7acdb12f5239594e593f2822de75c7a4c669f52f Author: Fokko Driesprong <fo...@apache.org> AuthorDate: Tue Sep 2 10:22:13 2025 +0200 Set the ManifestEntryStatus (#2408) A faulty refactor: https://github.com/apache/iceberg-python/commit/59742e01e8d190aa759e0154b03300bd81a28d02#diff-e9df836e263024ba54e2706853fb25c00269fbfe3726b440ba57f4a929c995dcR927 This produces incorrect metadata, but was hidden by the writer. <!-- Thanks for opening a pull request! --> <!-- In the case this PR will resolve an issue, please replace ${GITHUB_ISSUE_ID} below with the actual Github issue id. --> <!-- Closes #${GITHUB_ISSUE_ID} --> # Rationale for this change ## Are these changes tested? ## Are there any user-facing changes? <!-- In the case of user-facing changes, please add the changelog label. --> --------- Co-authored-by: Kevin Liu <kevinjq...@users.noreply.github.com> --- pyiceberg/manifest.py | 19 ++++++++----------- tests/catalog/test_sql.py | 4 ++++ 2 files changed, 12 insertions(+), 11 deletions(-) diff --git a/pyiceberg/manifest.py b/pyiceberg/manifest.py index a92d9448..470c99d6 100644 --- a/pyiceberg/manifest.py +++ b/pyiceberg/manifest.py @@ -1087,18 +1087,15 @@ class ManifestWriter(ABC): 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: diff --git a/tests/catalog/test_sql.py b/tests/catalog/test_sql.py index 27105e80..00868a57 100644 --- a/tests/catalog/test_sql.py +++ b/tests/catalog/test_sql.py @@ -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(