blackmwk commented on code in PR #2773:
URL: https://github.com/apache/iceberg-rust/pull/2773#discussion_r3948182669


##########
crates/iceberg/src/spec/datatypes.rs:
##########
@@ -594,16 +599,98 @@ impl TryFrom<SerdeNestedField> for NestedField {
     type Error = crate::Error;
 
     fn try_from(value: SerdeNestedField) -> Result<Self> {
-        let initial_default = value
-            .initial_default
-            .map(|x| Literal::try_from_json(x, &value.field_type))
-            .transpose()?
-            .flatten();
-        let write_default = value
-            .write_default
-            .map(|x| Literal::try_from_json(x, &value.field_type))
-            .transpose()?
-            .flatten();
+        fn validate_unknown_values(default: &JsonValue, field_type: &Type) -> 
Result<()> {

Review Comment:
   1. I think you should follow what we do in others types to do it in 
try_from_json
   2. I don't think you need to do validation in a recursive approach, when a 
field deserialized, its leaf field will be validated.



##########
crates/iceberg/src/spec/schema/mod.rs:
##########
@@ -190,6 +194,77 @@ impl SchemaBuilder {
         Ok(schema)
     }
 
+    fn validate_unknown_type_field(field: &NestedFieldRef) -> Result<()> {

Review Comment:
   I think you should move this part to NestedField



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