kevinjqliu commented on code in PR #2245:
URL: https://github.com/apache/iceberg-python/pull/2245#discussion_r2260594293
##########
pyiceberg/utils/schema_conversion.py:
##########
@@ -524,12 +524,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)
+
result = {
- "name": field.name,
- "field-id": field.field_id,
+ "name": field_name,
+ FIELD_ID_PROP: field.field_id,
"type": field_result if field.required else ["null", field_result],
}
+ if not is_valid_field_name:
+ result[ICEBERG_FIELD_NAME_PROP] = orig_field_name
Review Comment:
it was added to match the java implementation which is considered to be the
reference implementation
im actually not sure where `ICEBERG_FIELD_NAME_PROP` is used, even in the
java library.
--
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]