Skip to content

Commit 108ce0f

Browse files
authored
Remove leftover name-mapping bookkeeping from _ConvertToIceberg (#4381)
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.
1 parent d064b32 commit 108ce0f

1 file changed

Lines changed: 1 addition & 7 deletions

File tree

‎pyiceberg/io/pyarrow.py‎

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1465,7 +1465,7 @@ def primitive(self, primitive: pa.DataType) -> bool:
14651465

14661466

14671467
class _ConvertToIceberg(PyArrowSchemaVisitor[IcebergType | Schema]):
1468-
"""Converts PyArrowSchema to Iceberg Schema. Applies the IDs from name_mapping if provided."""
1468+
"""Converts PyArrowSchema to Iceberg Schema."""
14691469

14701470
_field_names: builtins.list[str]
14711471

@@ -1496,20 +1496,14 @@ def field(self, field: pa.Field, field_result: IcebergType) -> NestedField:
14961496

14971497
def list(self, list_type: pa.ListType, element_result: IcebergType) -> ListType:
14981498
element_field = list_type.value_field
1499-
self._field_names.append(LIST_ELEMENT_NAME)
15001499
element_id = self._field_id(element_field)
1501-
self._field_names.pop()
15021500
return ListType(element_id, element_result, element_required=not element_field.nullable)
15031501

15041502
def map(self, map_type: pa.MapType, key_result: IcebergType, value_result: IcebergType) -> MapType:
15051503
key_field = map_type.key_field
1506-
self._field_names.append(MAP_KEY_NAME)
15071504
key_id = self._field_id(key_field)
1508-
self._field_names.pop()
15091505
value_field = map_type.item_field
1510-
self._field_names.append(MAP_VALUE_NAME)
15111506
value_id = self._field_id(value_field)
1512-
self._field_names.pop()
15131507
return MapType(key_id, key_result, value_id, value_result, value_required=not value_field.nullable)
15141508

15151509
def primitive(self, primitive: pa.DataType) -> PrimitiveType:

0 commit comments

Comments
 (0)