smaheshwar-pltr commented on code in PR #2031: URL: https://github.com/apache/iceberg-python/pull/2031#discussion_r2101324338
########## pyiceberg/table/snapshots.py: ########## @@ -440,11 +440,40 @@ def ancestors_of(current_snapshot: Optional[Snapshot], table_metadata: TableMeta def ancestors_between( from_snapshot: Optional[Snapshot], to_snapshot: Snapshot, table_metadata: TableMetadata ) -> Iterable[Snapshot]: - """Get the ancestors of and including the given snapshot between the to and from snapshots.""" + """Get the ancestors of and including the given snapshot between the to and from snapshots, both inclusively.""" if from_snapshot is not None: for snapshot in ancestors_of(to_snapshot, table_metadata): yield snapshot if snapshot == from_snapshot: break else: yield from ancestors_of(to_snapshot, table_metadata) + + +def ancestors_between_ids( + from_snapshot_id_exclusive: Optional[int], + to_snapshot_id_inclusive: int, + table_metadata: TableMetadata, +) -> Iterable[Snapshot]: + """Return the ancestors of and including the given "to" snapshot, up to but not including the "from" snapshot. + + If from_snapshot_id_exclusive is None or no ancestors of the "to" snapshot match it, all ancestors of the "to" + snapshot are returned. + """ + if from_snapshot_id_exclusive is not None: Review Comment: I'm following the structure of `ancestors_between` above here and caseworking, but I don't think it's strictly needed though -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org