rdblue commented on code in PR #5124:
URL: https://github.com/apache/iceberg/pull/5124#discussion_r917459515


##########
python/pyiceberg/table/metadata.py:
##########
@@ -62,21 +62,25 @@ def check_partition_specs(values: Dict[str, Any]) -> 
Dict[str, Any]:
 
 def check_sort_orders(values: Dict[str, Any]) -> Dict[str, Any]:
     """Validator to check if the default_sort_order_id is present in 
sort-orders"""
-    default_sort_order_id = values["default_sort_order_id"]
+    default_sort_order_id: int = values["default_sort_order_id"]
 
-    if default_sort_order_id != DEFAULT_SORT_ORDER_UNSORTED:
-        for sort in values["sort_orders"]:
-            if sort["order-id"] == default_sort_order_id:
+    if default_sort_order_id != UNSORTED_SORT_ORDER_ID:
+        sort_orders: List[SortOrder] = values["sort_orders"]
+        for sort_order in sort_orders:
+            if sort_order.order_id == default_sort_order_id:
                 return values
 
-        raise ValidationError(f"default-sort-order-id {default_sort_order_id} 
can't be found")
+        raise ValidationError(f"default-sort-order-id {default_sort_order_id} 
can't be found in {sort_orders}")
     return values
 
 
 class TableMetadataCommonFields(IcebergBaseModel):
     """Metadata for an Iceberg table as specified in the Apache Iceberg
     spec (https://iceberg.apache.org/spec/#iceberg-table-spec)"""
 
+    def current_schema(self) -> Schema:
+        return next(schema for schema in self.schemas if schema.schema_id == 
self.current_schema_id)

Review Comment:
   We may want to index these for quick lookup, but it seems minor. I'm not 
really sure if it is worth it.



-- 
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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to