Fokko commented on code in PR #252:
URL: https://github.com/apache/iceberg-python/pull/252#discussion_r1467065763
##########
pyiceberg/io/pyarrow.py:
##########
@@ -1152,24 +1163,31 @@ def field(self, field: NestedField, _:
Optional[pa.Array], field_array: Optional
return field_array
def list(self, list_type: ListType, list_array: Optional[pa.Array],
value_array: Optional[pa.Array]) -> Optional[pa.Array]:
- return (
- pa.ListArray.from_arrays(list_array.offsets,
self.cast_if_needed(list_type.element_field, value_array))
- if isinstance(list_array, pa.ListArray)
- else None
- )
+ if isinstance(list_array, pa.ListArray) and value_array is not None:
+ arrow_field =
pa.list_(self._construct_field(list_type.element_field, value_array.type))
+ if isinstance(value_array, pa.StructArray):
+ # Arrow does not allow reordering of fields, therefore we have
to copy the array :(
Review Comment:
I've pushed a fix, but I don't think we can solve this yet without a fix in
Arrow upstream 😢 https://github.com/apache/arrow/issues/38809
--
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]