rdblue commented on code in PR #7782:
URL: https://github.com/apache/iceberg/pull/7782#discussion_r1295068797


##########
python/pyiceberg/io/pyarrow.py:
##########
@@ -781,7 +781,7 @@ def _task_to_table(
             schema_raw = metadata.get(ICEBERG_SCHEMA)
         # TODO: if field_ids are not present, Name Mapping should be 
implemented to look them up in the table schema,
         #  see https://github.com/apache/iceberg/issues/7451
-        file_schema = Schema.parse_raw(schema_raw) if schema_raw is not None 
else pyarrow_to_schema(physical_schema)
+        file_schema = Schema.model_validate_json(schema_raw) if schema_raw is 
not None else pyarrow_to_schema(physical_schema)

Review Comment:
   Nit: It uses "validate" instead of "parse"? That seems weird to me.



##########
python/pyiceberg/types.py:
##########
@@ -390,25 +446,49 @@ def __init__(
         value_required: bool = True,
         **data: Any,
     ):
-        data["key_id"] = key_id or data["key-id"]
-        data["key_type"] = key_type or data["key"]
-        data["value_id"] = value_id or data["value-id"]
-        data["value_type"] = value_type or data["value"]
-        data["value_required"] = value_required if value_required is not None 
else data["value_required"]
-
-        data["key_field"] = NestedField(name="key", field_id=data["key_id"], 
field_type=data["key_type"], required=True)
-        data["value_field"] = NestedField(
-            name="value", field_id=data["value_id"], 
field_type=data["value_type"], required=data["value_required"]
-        )
+        data["key-id"] = data["key-id"] if "key-id" in data else key_id
+        data["key"] = data["key"] if "key" in data else key_type
+        data["value-id"] = data["value-id"] if "value-id" in data else value_id
+        data["value"] = data["value"] if "value" in data else value_type
+        data["value_required"] = data["value_required"] if "value_required" in 
data else value_required

Review Comment:
   Should this be `value-required`?



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

Reply via email to