ndrluis commented on code in PR #1285: URL: https://github.com/apache/iceberg-python/pull/1285#discussion_r1828195893
########## pyiceberg/table/__init__.py: ########## @@ -663,6 +666,42 @@ def update_location(self, location: str) -> Transaction: """ raise NotImplementedError("Not yet implemented") + def set_statistics(self, snapshot_id: int, statistics_file: StatisticsFile) -> Transaction: + """Set the statistics for a snapshot. + + Args: + snapshot_id: The snapshot ID to set the statistics for. + statistics_file: The statistics file to set. + + Returns: + The alter table builder. + """ + updates = ( + SetStatisticsUpdate( + snapshot_id=snapshot_id, + statistics=statistics_file, + ), + ) + + return self._apply(updates, ()) + + def remove_statistics(self, snapshot_id: int) -> Transaction: + """Remove the statistics for a snapshot. + + Args: + snapshot_id: The snapshot ID to remove the statistics for. + + Returns: + The alter table builder. + """ + updates = ( + RemoveStatisticsUpdate( Review Comment: I understand that we want to remove the statistics of a specific snapshot, and I understand that we have one statistics file per snapshot. The equivalent code would be the [SetStatistics](https://github.com/apache/iceberg/blob/af5be32fbef36690d32b5e53c4153b709d8db188/core/src/main/java/org/apache/iceberg/SetStatistics.java#L27) class, which follows the same pattern as our [ManageSnapshot](https://github.com/apache/iceberg-python/blob/main/pyiceberg/table/update/snapshot.py#L724) class. This is the scenario I want to double-check to ensure we follow the same pattern. -- 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