Fokko commented on code in PR #5627:
URL: https://github.com/apache/iceberg/pull/5627#discussion_r954322511


##########
python/pyiceberg/table/partitioning.py:
##########
@@ -157,3 +159,20 @@ def compatible_with(self, other: "PartitionSpec") -> bool:
 
 
 UNPARTITIONED_PARTITION_SPEC = PartitionSpec(spec_id=0)
+
+
+def assign_fresh_partition_spec_ids(spec: PartitionSpec, schema: Schema) -> 
PartitionSpec:
+    partition_fields = []
+    for pos, field in enumerate(spec.fields):
+        schema_field = schema.find_field(field.name)

Review Comment:
   Great catch! 👍🏻 



##########
python/pyiceberg/table/sorting.py:
##########
@@ -135,3 +140,31 @@ def __str__(self) -> str:
 
 UNSORTED_SORT_ORDER_ID = 0
 UNSORTED_SORT_ORDER = SortOrder(order_id=UNSORTED_SORT_ORDER_ID)
+INITIAL_SORT_ORDER_ID = 1
+
+
+def assign_fresh_sort_order_ids(sort_order: SortOrder, old_schema: Schema, 
fresh_schema: Schema) -> SortOrder:
+    if sort_order.is_unsorted:
+        return UNSORTED_SORT_ORDER
+
+    fresh_fields = []
+    for field in sort_order.fields:
+        original_field = old_schema.find_field(field.source_id)
+        if original_field is None:
+            raise ValueError(f"Could not find in original schema: {field}")
+        fresh_field = fresh_schema.find_field(original_field.name)

Review Comment:
   Thanks!



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

Reply via email to