kevinjqliu commented on code in PR #2245:
URL: https://github.com/apache/iceberg-python/pull/2245#discussion_r2246271818
##########
pyiceberg/utils/schema_conversion.py:
##########
@@ -524,12 +532,19 @@ def field(self, field: NestedField, field_result:
AvroType) -> AvroType:
if isinstance(field_result, dict) and field_result.get("type") ==
"record":
field_result["name"] = f"r{field.field_id}"
+ orig_field_name = field.name
+ is_valid_field_name = _valid_avro_name(orig_field_name)
+ field_name = orig_field_name if is_valid_field_name else
make_compatible_name(orig_field_name)
Review Comment:
nit: `make_compatible_name` already calls `_valid_avro_name `
https://github.com/apache/iceberg-python/blob/904c0b77c33768716e8672b38bae73bfcf565fbf/pyiceberg/schema.py#L1357-L1361
we can simply this part
```suggestion
field_name = make_compatible_name(orig_field_name)
```
--
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]