rdblue commented on code in PR #5627: URL: https://github.com/apache/iceberg/pull/5627#discussion_r956788235
########## python/pyiceberg/table/metadata.py: ########## @@ -327,24 +334,43 @@ def check_sort_orders(cls, values: Dict[str, Any]): based on the spec. Implementations must throw an exception if a table’s version is higher than the supported version.""" - table_uuid: UUID = Field(alias="table-uuid", default_factory=uuid.uuid4) - """A UUID that identifies the table, generated when the table is created. - Implementations must throw an exception if a table’s UUID does not match - the expected UUID after refreshing metadata.""" - last_sequence_number: int = Field(alias="last-sequence-number", default=INITIAL_SEQUENCE_NUMBER) """The table’s highest assigned sequence number, a monotonically increasing long that tracks the order of snapshots in a table.""" -class TableMetadata: +TableMetadata = Union[TableMetadataV1, TableMetadataV2] + + +def new_table_metadata( + schema: Schema, partition_spec: PartitionSpec, sort_order: SortOrder, location: str, properties: Properties = EMPTY_DICT +) -> TableMetadata: + fresh_schema = assign_fresh_schema_ids(schema) + fresh_partition_spec = assign_fresh_partition_spec_ids(partition_spec, fresh_schema) + fresh_sort_order = assign_fresh_sort_order_ids(sort_order, schema, fresh_schema) + + return TableMetadataV2( Review Comment: Yeah, I almost commented last time. I think this is reasonable. -- 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