slachiewicz commented on code in PR #4268:
URL: https://github.com/apache/iceberg-python/pull/4268#discussion_r4448309775


##########
pyiceberg/io/pyarrow.py:
##########
@@ -2131,8 +2131,13 @@ def struct(
                 array = self._cast_if_needed(field, field_array)
                 field_arrays.append(array)
                 fields.append(self._construct_field(field, array.type))
-            elif field.optional or field.initial_default is not None:
-                # When an optional field is added, or when a required field 
with a non-null initial default is added
+            elif (
+                field.optional
+                or field.initial_default is not None
+                or self._projected_missing_fields.get(field.field_id) is not 
None

Review Comment:
   Fixed in a648233: a null partition value now fills a required child when its 
parent struct is null in every row, and still raises when a parent is present. 
Covered by 
`test_identity_transform_column_projection_required_field_under_null_parent`.



##########
pyiceberg/io/pyarrow.py:
##########
@@ -2131,8 +2131,13 @@ def struct(
                 array = self._cast_if_needed(field, field_array)
                 field_arrays.append(array)
                 fields.append(self._construct_field(field, array.type))
-            elif field.optional or field.initial_default is not None:
-                # When an optional field is added, or when a required field 
with a non-null initial default is added
+            elif (
+                field.optional
+                or field.initial_default is not None
+                or self._projected_missing_fields.get(field.field_id) is not 
None

Review Comment:
   Fixed in a648233: the identity partition value is checked before 
`initial-default`, so a null value for a required field raises whether or not 
the field has a default. 
`test_identity_transform_column_projection_required_field` now runs with and 
without one.



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

Reply via email to