Fokko commented on code in PR #2367:
URL: https://github.com/apache/iceberg-python/pull/2367#discussion_r2575585406


##########
pyiceberg/partitioning.py:
##########
@@ -222,11 +223,13 @@ def partition_type(self, schema: Schema) -> StructType:
         :return: A StructType that represents the PartitionSpec, with a 
NestedField for each PartitionField.
         """
         nested_fields = []
+        schema_ids = index_by_id(schema)

Review Comment:
   This is a bit of a hot path, and the `index_by_id` is not cheap. How about 
using the private method here:
   
   ```suggestion
           schema_ids = schema._lazy_id_to_field  # type: ignore
   ```
   
   Or we can call it directly below. The `_lazy_id_to_field` is cached and 
therefore we don't compute it for each `DataFile`.



-- 
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