Fokko commented on code in PR #1539: URL: https://github.com/apache/iceberg-python/pull/1539#discussion_r1922765663
########## pyiceberg/io/pyarrow.py: ########## @@ -2594,42 +2566,46 @@ def _determine_partitions(spec: PartitionSpec, schema: Schema, arrow_table: pa.T We then retrieve the partition keys by offsets. And slice the arrow table by offsets and lengths of each partition. """ - partition_columns: List[Tuple[PartitionField, NestedField]] = [ - (partition_field, schema.find_field(partition_field.source_id)) for partition_field in spec.fields - ] - partition_values_table = pa.table( - { - str(partition.field_id): partition.transform.pyarrow_transform(field.field_type)(arrow_table[field.name]) - for partition, field in partition_columns - } - ) + # Assign unique names to columns where the partition transform has been applied + # to avoid conflicts + partition_fields = [f"_partition_{field.name}" for field in spec.fields] + + for partition, name in zip(spec.fields, partition_fields): + source_field = schema.find_field(partition.source_id) + arrow_table = arrow_table.append_column( + name, partition.transform.pyarrow_transform(source_field.field_type)(arrow_table[source_field.name]) + ) + + unique_partition_fields = arrow_table.select(partition_fields).group_by(partition_fields).aggregate([]) Review Comment: Thanks, good point. If the tests are stable, I don't think we need stable ordering to allow for better performance using multithreading -- 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