geruh commented on code in PR #614: URL: https://github.com/apache/iceberg-python/pull/614#discussion_r1571235918
########## pyiceberg/table/__init__.py: ########## @@ -3537,6 +3537,58 @@ def update_partitions_map( schema=table_schema, ) + def files(self) -> "pa.Table": + import pyarrow as pa + + files_schema = pa.schema([ + pa.field('content', pa.int8(), nullable=False), + pa.field('file_path', pa.string(), nullable=False), + pa.field('file_format', pa.string(), nullable=False), + pa.field('record_count', pa.int64(), nullable=False), + pa.field('file_size_in_bytes', pa.int64(), nullable=False), + pa.field('column_sizes', pa.map_(pa.int32(), pa.int64()), nullable=True), + pa.field('value_counts', pa.map_(pa.int32(), pa.int64()), nullable=True), + pa.field('null_value_counts', pa.map_(pa.int32(), pa.int64()), nullable=True), + pa.field('nan_value_counts', pa.map_(pa.int32(), pa.int64()), nullable=True), + pa.field('lower_bounds', pa.map_(pa.int32(), pa.binary()), nullable=True), + pa.field('upper_bounds', pa.map_(pa.int32(), pa.binary()), nullable=True), + pa.field('key_metadata', pa.binary(), nullable=True), + pa.field('split_offsets', pa.list_(pa.int64()), nullable=True), + pa.field('equality_ids', pa.list_(pa.int32()), nullable=True), + ]) + + files = [] + + snapshot = self.tbl.current_snapshot() + if not snapshot: + return pa.pylist([]) + + io = self.tbl.io + for manifest_list in snapshot.manifests(io): + for manifest_entry in manifest_list.fetch_manifest_entry(io): + data_file = manifest_entry.data_file + files.append({ + 'content': data_file.content, + 'file_path': data_file.file_path, + 'file_format': data_file.file_format, Review Comment: What do you think about making this a categorical type, similar to what we did for the refs table #602 -- 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