Fokko commented on code in PR #902: URL: https://github.com/apache/iceberg-python/pull/902#discussion_r1672440233
########## pyiceberg/io/pyarrow.py: ########## @@ -1268,14 +1265,8 @@ def __init__(self, file_schema: Schema): def _cast_if_needed(self, field: NestedField, values: pa.Array) -> pa.Array: file_field = self.file_schema.find_field(field.field_id) - if field.field_type.is_primitive: - if field.field_type != file_field.field_type: - return values.cast(schema_to_pyarrow(promote(file_field.field_type, field.field_type), include_field_ids=False)) - elif (target_type := schema_to_pyarrow(field.field_type, include_field_ids=False)) != values.type: Review Comment: I just pushed a potential solution: https://github.com/apache/iceberg-python/pull/902/commits/4ca513b732b7ecc79d2369d18d0d2028ae0b8e84 This makes the abovementioned test pass on my end. We just make ensure that we write a schema that's compatible with the table schema. -- 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