smaheshwar-pltr commented on code in PR #2430:
URL: https://github.com/apache/iceberg-python/pull/2430#discussion_r2328802247
##########
pyiceberg/table/update/snapshot.py:
##########
@@ -924,9 +924,12 @@ class
ExpireSnapshots(UpdateTableMetadata["ExpireSnapshots"]):
Pending changes are applied on commit.
"""
- _snapshot_ids_to_expire: Set[int] = set()
- _updates: Tuple[TableUpdate, ...] = ()
- _requirements: Tuple[TableRequirement, ...] = ()
+ def __init__(self, transaction: Transaction) -> None:
+ super().__init__(transaction)
+ # Initialize instance-level attributes to avoid sharing state between
instances
+ self._snapshot_ids_to_expire: Set[int] = set()
+ self._updates: Tuple[TableUpdate, ...] = ()
+ self._requirements: Tuple[TableRequirement, ...] = ()
Review Comment:
Good catch!
Nit: I'd personally keep class-level _annotations_ here (with _assignment_
in the constructor, so state still isn't shared), so the code would look
similar to what we have for `Transaction`:
https://github.com/apache/iceberg-python/blob/52d810efb62e39ec6d8d6a2f4cd2cad8165e2d2c/pyiceberg/table/__init__.py#L247-L263
--
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]