soumya-ghosh commented on code in PR #1626: URL: https://github.com/apache/iceberg-python/pull/1626#discussion_r2081380859
########## pyiceberg/table/inspect.py: ########## @@ -523,7 +523,67 @@ def history(self) -> "pa.Table": return pa.Table.from_pylist(history, schema=history_schema) - def _files(self, snapshot_id: Optional[int] = None, data_file_filter: Optional[Set[DataFileContent]] = None) -> "pa.Table": + def _get_files_from_manifest( + self, manifest_list: ManifestFile, data_file_filter: Optional[Set[DataFileContent]] = None + ) -> "pa.Table": + import pyarrow as pa + + files: list[dict[str, Any]] = [] + schema = self.tbl.metadata.schema() + io = self.tbl.io + + for manifest_entry in manifest_list.fetch_manifest_entry(io): + data_file = manifest_entry.data_file + if data_file_filter and data_file.content not in data_file_filter: + continue + column_sizes = data_file.column_sizes or {} + value_counts = data_file.value_counts or {} + null_value_counts = data_file.null_value_counts or {} + nan_value_counts = data_file.nan_value_counts or {} + lower_bounds = data_file.lower_bounds or {} + upper_bounds = data_file.upper_bounds or {} + readable_metrics = { + schema.find_column_name(field.field_id): { + "column_size": column_sizes.get(field.field_id), + "value_count": value_counts.get(field.field_id), + "null_value_count": null_value_counts.get(field.field_id), + "nan_value_count": nan_value_counts.get(field.field_id), + "lower_bound": from_bytes(field.field_type, lower_bound) + if (lower_bound := lower_bounds.get(field.field_id)) + else None, + "upper_bound": from_bytes(field.field_type, upper_bound) + if (upper_bound := upper_bounds.get(field.field_id)) + else None, + } + for field in self.tbl.metadata.schema().fields + } + files.append( + { + "content": data_file.content, + "file_path": data_file.file_path, + "file_format": data_file.file_format, + "spec_id": data_file.spec_id, Review Comment: order of `spec_id` and `partition` column fixed. -- 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