HonahX commented on code in PR #252: URL: https://github.com/apache/iceberg-python/pull/252#discussion_r1464527694
########## 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: It seems adding the following before line 1167 ```python if list_array.is_null(): return None ``` can let me pass the above test. -- 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