File tree Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Expand file tree Collapse file tree 2 files changed +19
-2
lines changed Original file line number Diff line number Diff line change 36
36
SortOrder ,
37
37
assign_fresh_sort_order_ids ,
38
38
)
39
- from pyiceberg .table .statistics import StatisticsFile
39
+ from pyiceberg .table .statistics import PartitionStatisticsFile , StatisticsFile
40
40
from pyiceberg .typedef import (
41
41
EMPTY_DICT ,
42
42
IcebergBaseModel ,
@@ -222,6 +222,14 @@ class TableMetadataCommonFields(IcebergBaseModel):
222
222
table correctly. A table can contain many statistics files
223
223
associated with different table snapshots."""
224
224
225
+ partition_statistics : List [PartitionStatisticsFile ] = Field (alias = "partition-statistics" , default_factory = list )
226
+ """A optional list of partition statistics files.
227
+ Partition statistics are not required for reading or planning
228
+ and readers may ignore them. Each table snapshot may be associated
229
+ with at most one partition statistics file. A writer can optionally
230
+ write the partition statistics file during each write operation,
231
+ or it can also be computed on demand."""
232
+
225
233
# validators
226
234
@field_validator ("properties" , mode = "before" )
227
235
def transform_properties_dict_value_to_str (cls , properties : Properties ) -> Dict [str , str ]:
Original file line number Diff line number Diff line change @@ -29,15 +29,24 @@ class BlobMetadata(IcebergBaseModel):
29
29
properties : Optional [Dict [str , str ]] = None
30
30
31
31
32
- class StatisticsFile (IcebergBaseModel ):
32
+ class StatisticsCommonFields (IcebergBaseModel ):
33
+ """Common fields between table and partition statistics structs found on metadata."""
34
+
33
35
snapshot_id : int = Field (alias = "snapshot-id" )
34
36
statistics_path : str = Field (alias = "statistics-path" )
35
37
file_size_in_bytes : int = Field (alias = "file-size-in-bytes" )
38
+
39
+
40
+ class StatisticsFile (StatisticsCommonFields , IcebergBaseModel ):
36
41
file_footer_size_in_bytes : int = Field (alias = "file-footer-size-in-bytes" )
37
42
key_metadata : Optional [str ] = Field (alias = "key-metadata" , default = None )
38
43
blob_metadata : List [BlobMetadata ] = Field (alias = "blob-metadata" )
39
44
40
45
46
+ class PartitionStatisticsFile (IcebergBaseModel ):
47
+ pass
48
+
49
+
41
50
def filter_statistics_by_snapshot_id (
42
51
statistics : List [StatisticsFile ],
43
52
reject_snapshot_id : int ,
You can’t perform that action at this time.
0 commit comments