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


##########
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:
   Addressed in 0d5414b0. Unknown JSON defaults are now validated by 
`Literal::try_from_json`, the custom recursive JSON validation was removed, and 
struct literal parsing now propagates nested conversion errors. Added a focused 
regression test for null/non-null unknown JSON values.



##########
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:
   Addressed in 0d5414b0. The unknown-type field invariant and nested-default 
checks now live on `NestedField::validate_unknown_type`; `SchemaBuilder` 
delegates to that method.



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