From 2bfa91231528ff7ab0060c9ab1a57e2a70f34b51 Mon Sep 17 00:00:00 2001 From: chenjian2664 Date: Sun, 15 Nov 2026 09:15:55 +0800 Subject: [PATCH] Remove leftover name-mapping bookkeeping from _ConvertToIceberg Name mapping moved out of this visitor into apply_name_mapping in #1014, but the docstring still claims it applies name-mapping IDs, and list() and map() still push and pop field names around the _field_id calls, which no longer read them. --- pyiceberg/io/pyarrow.py | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/pyiceberg/io/pyarrow.py b/pyiceberg/io/pyarrow.py index 6192f13b14..131f913172 100644 --- a/pyiceberg/io/pyarrow.py +++ b/pyiceberg/io/pyarrow.py @@ -1465,7 +1465,7 @@ def primitive(self, primitive: pa.DataType) -> bool: class _ConvertToIceberg(PyArrowSchemaVisitor[IcebergType | Schema]): - """Converts PyArrowSchema to Iceberg Schema. Applies the IDs from name_mapping if provided.""" + """Converts PyArrowSchema to Iceberg Schema.""" _field_names: builtins.list[str] @@ -1496,20 +1496,14 @@ def field(self, field: pa.Field, field_result: IcebergType) -> NestedField: def list(self, list_type: pa.ListType, element_result: IcebergType) -> ListType: element_field = list_type.value_field - self._field_names.append(LIST_ELEMENT_NAME) element_id = self._field_id(element_field) - self._field_names.pop() return ListType(element_id, element_result, element_required=not element_field.nullable) def map(self, map_type: pa.MapType, key_result: IcebergType, value_result: IcebergType) -> MapType: key_field = map_type.key_field - self._field_names.append(MAP_KEY_NAME) key_id = self._field_id(key_field) - self._field_names.pop() value_field = map_type.item_field - self._field_names.append(MAP_VALUE_NAME) value_id = self._field_id(value_field) - self._field_names.pop() return MapType(key_id, key_result, value_id, value_result, value_required=not value_field.nullable) def primitive(self, primitive: pa.DataType) -> PrimitiveType: