smaheshwar-pltr commented on code in PR #1958:
URL: https://github.com/apache/iceberg-python/pull/1958#discussion_r2102924653
##########
pyiceberg/table/inspect.py:
##########
@@ -678,6 +689,28 @@ def all_manifests(self) -> "pa.Table":
)
return pa.concat_tables(manifests_by_snapshots)
+ def _all_known_files(self) -> dict[str, set[str]]:
+ """Get all the known files in the table.
+
+ Returns:
+ dict of {file_type: set of file paths} for each file type.
+ """
+ snapshots = self.tbl.snapshots()
+
+ _all_known_files = {}
+ _all_known_files["manifests"] =
set(self.all_manifests(snapshots)["path"].to_pylist())
+ _all_known_files["manifest_lists"] = {snapshot.manifest_list for
snapshot in snapshots}
+ _all_known_files["statistics"] = {statistic.statistics_path for
statistic in self.tbl.metadata.statistics}
Review Comment:
Nice!
Looking at the Java side, there seems to be a focus on (especially in tests)
partition statistics files being not deleted by the procedure too. I don't
think this is a concern here because PyIceberg doesn't support reading tables
with partition statistics in the first place. But I think it should soon (I put
up https://github.com/apache/iceberg-python/issues/2034 /
https://github.com/apache/iceberg-python/pull/2033) in which case this logic
would have to include that.
--
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]