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


##########
pyiceberg/io/pyarrow.py:
##########
@@ -2765,3 +2767,22 @@ def _determine_partitions(spec: PartitionSpec, schema: 
Schema, arrow_table: pa.T
         )
 
     return table_partitions
+
+
+def _get_field_from_arrow_table(arrow_table: pa.Table, field_path: str) -> 
pa.Array:
+    """Get a nested field from an Arrow table struct type field using dot 
notation.
+
+    Args:
+        arrow_table: The Arrow table containing the field
+        field_path: Dot-separated field path (e.g., "name" or 
"bar.baz.timestamp")
+
+    Returns:
+        The unnested field as a PyArrow Array
+    """
+    if "." not in field_path:
+        return arrow_table[field_path]
+
+    path_parts = field_path.split(".")
+    field_array = arrow_table[path_parts[0]]
+    field_array = pc.struct_field(field_array, path_parts[1:])

Review Comment:
   maybe add this as a comment since it was not obvious



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