lawofcycles commented on code in PR #3320:
URL: https://github.com/apache/iceberg-python/pull/3320#discussion_r3331522515
##########
pyiceberg/table/update/snapshot.py:
##########
@@ -499,6 +548,62 @@ def files_affected(self) -> bool:
"""Indicate if any manifest-entries can be dropped."""
return len(self._deleted_entries()) > 0
+ def _refresh_for_retry(self) -> None:
+ """Reset state for a retry attempt, clearing the cached delete
computation."""
+ super()._refresh_for_retry()
+ # Clear @cached_property by removing it from the instance __dict__.
+ # _compute_deletes depends on _parent_snapshot_id which changes on
retry.
+ if "_compute_deletes" in self.__dict__:
+ del self.__dict__["_compute_deletes"]
+
+ def _validate_concurrency(self) -> None:
+ """Validate that concurrent changes do not conflict with this delete.
+
+ Note: This method is intentionally duplicated in _OverwriteFiles
rather than
+ extracted to the base class. While the logic is currently identical,
Java Iceberg's
+ BaseOverwriteFiles and BaseRowDelta have divergent validation. Keeping
them separate
+ makes it easier to add RowDelta-specific validation in the future.
+ """
+ from pyiceberg.table import TableProperties
+ from pyiceberg.table.snapshots import IsolationLevel
+ from pyiceberg.table.update.validate import (
+ _validate_added_data_files,
+ _validate_deleted_data_files,
+ _validate_no_new_delete_files,
+ _validate_no_new_deletes_for_data_files,
+ )
+
+ if self._parent_snapshot_id is None:
+ return
+
+ table = self._transaction._table
+ parent_snapshot =
table.metadata.snapshot_by_id(self._parent_snapshot_id)
+ if parent_snapshot is None:
Review Comment:
Good catch. Now raises ValidationException when the ID is non-null but
unresolvable. The `_parent_snapshot_id is None` early return stays for the
empty-table case.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]