kevinjqliu commented on code in PR #1867:
URL: https://github.com/apache/iceberg-python/pull/1867#discussion_r2021942387


##########
pyiceberg/io/pyarrow.py:
##########
@@ -1777,7 +1777,7 @@ def struct(
                 field_arrays.append(array)
                 fields.append(self._construct_field(field, array.type))
             elif field.optional:
-                arrow_type = schema_to_pyarrow(field.field_type, 
include_field_ids=False)
+                arrow_type = schema_to_pyarrow(field.field_type, 
include_field_ids=self._include_field_ids)

Review Comment:
   I found 3 other places where `include_field_ids=False`
   * in 
[`to_table`](https://github.com/apache/iceberg-python/blob/d69a19113ea537d16c34b60ab6e69c4285f933c0/pyiceberg/io/pyarrow.py#L1600),
 this is fine since we're just materializing the table from record batches
   * in 
[`_to_requested_schema`](https://github.com/apache/iceberg-python/blob/d69a19113ea537d16c34b60ab6e69c4285f933c0/pyiceberg/io/pyarrow.py#L1674),
 the 2 places where `_to_requested_schema` is called sets 
`include_field_ids=True` 
([1](https://github.com/apache/iceberg-python/blob/d69a19113ea537d16c34b60ab6e69c4285f933c0/pyiceberg/io/pyarrow.py#L1449-L1454),
 
[2](https://github.com/apache/iceberg-python/blob/d69a19113ea537d16c34b60ab6e69c4285f933c0/pyiceberg/io/pyarrow.py#L2420-L2425))
   * in [`ArrowProjectionVisitor` 
](https://github.com/apache/iceberg-python/blob/d69a19113ea537d16c34b60ab6e69c4285f933c0/pyiceberg/io/pyarrow.py#L1696),
 but this is only called 
[here](https://github.com/apache/iceberg-python/blob/d69a19113ea537d16c34b60ab6e69c4285f933c0/pyiceberg/io/pyarrow.py#L1680)
 get uses the `include_field_ids` from `_to_requested_schema`, which sets 
`include_field_ids=True`
   



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

Reply via email to