chinmay-bhat commented on code in PR #748:
URL: https://github.com/apache/iceberg-python/pull/748#discussion_r1603586709
##########
pyiceberg/table/metadata.py:
##########
@@ -230,6 +230,14 @@ def snapshot_by_id(self, snapshot_id: int) ->
Optional[Snapshot]:
"""Get the snapshot by snapshot_id."""
return next((snapshot for snapshot in self.snapshots if
snapshot.snapshot_id == snapshot_id), None)
+ def latest_snapshot_before_timestamp(self, timestamp_ms: int) ->
Optional[Snapshot]:
+ """Get the snapshot right before the given timestamp."""
+ result, prev_timestamp = None, 0
+ for snapshot in self.snapshots:
Review Comment:
Instead of searching for a valid snapshot in self.snapshots (which has all
valid snapshots irrespective of branch), I should probably write an API to find
all ancestors of current snapshot and iterate over those snapshots only.
--
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]