rdblue commented on code in PR #6506: URL: https://github.com/apache/iceberg/pull/6506#discussion_r1060141470
########## python/pyiceberg/manifest.py: ########## @@ -104,29 +104,100 @@ class ManifestEntry(IcebergBaseModel): data_file: DataFile = Field() +PARTITION_FIELD_SUMMARY_TYPE = StructType( + NestedField(509, "contains_null", BooleanType(), required=True), + NestedField(518, "contains_nan", BooleanType(), required=False), + NestedField(510, "lower_bound", BinaryType(), required=False), + NestedField(511, "upper_bound", BinaryType(), required=False) +) + + class PartitionFieldSummary(IcebergBaseModel): contains_null: bool = Field() contains_nan: Optional[bool] = Field() lower_bound: Optional[bytes] = Field() upper_bound: Optional[bytes] = Field() -class ManifestFile(IcebergBaseModel): - manifest_path: str = Field() - manifest_length: int = Field() - partition_spec_id: int = Field() - content: ManifestContent = Field(default=ManifestContent.DATA) - sequence_number: int = Field(default=0) - min_sequence_number: int = Field(default=0) - added_snapshot_id: Optional[int] = Field() - added_data_files_count: Optional[int] = Field() - existing_data_files_count: Optional[int] = Field() - deleted_data_files_count: Optional[int] = Field() - added_rows_count: Optional[int] = Field() - existing_rows_counts: Optional[int] = Field() - deleted_rows_count: Optional[int] = Field() - partitions: Optional[List[PartitionFieldSummary]] = Field() - key_metadata: Optional[bytes] = Field() +MANIFEST_FILE_SCHEMA: Schema = Schema( + NestedField(500, "manifest_path", StringType(), required=True, doc="Location URI with FS scheme"), + NestedField(501, "manifest_length", LongType(), required=True), + NestedField(502, "partition_spec_id", IntegerType(), required=True), + NestedField(517, "content", IntegerType(), required=False), + NestedField(515, "sequence_number", LongType(), required=False), + NestedField(516, "min_sequence_number", LongType(), required=False), + NestedField(503, "added_snapshot_id", LongType(), required=False), + NestedField(504, "added_data_files_count", IntegerType(), required=False), + NestedField(505, "existing_data_files_count", IntegerType(), required=False), + NestedField(506, "deleted_data_files_count", IntegerType(), required=False), + NestedField(512, "added_rows_count", LongType(), required=False), + NestedField(513, "existing_rows_count", LongType(), required=False), + NestedField(514, "deleted_rows_count", LongType(), required=False), + NestedField(507, "partitions", ListType(508, PARTITION_FIELD_SUMMARY_TYPE, element_required=True), required=False), + NestedField(519, "key_metadata", BinaryType(), required=False), +) + +MANIFEST_FILE_FIELD_NAMES: Dict[int, str] = {pos: field.name for pos, field in MANIFEST_FILE_SCHEMA.fields} +IN_TRANSFORMS: Dict[int, Callable[[Any], Any]] = { + 3: lambda id: ManifestContent.DATA if id == 0 else ManifestContent.DELETES Review Comment: We should replace this with a method that decodes the id. -- 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