badalprasadsingh commented on PR #1359:
URL: https://github.com/apache/iceberg-go/pull/1359#issuecomment-5057101960

   > **Medium — write default validated against pre-promotion type** 
(`table/update_schema.go:847`) `setWriteDefault` validates the incoming default 
against `existing.Type` even when the same union op just promoted the column. A 
default valid for the promoted type but not the old one (e.g. a wider 
`decimal(18,2)` default during `decimal(9,2) -> decimal(18,2)`) is wrongly 
rejected. _Fix:_ validate against the pending updated field type (pass 
`newField.Type` after the promotion is staged).
   
   Fixed. `unionUpdateColumn` now validates the write-default against the 
promoted type when the same op stages a type change (falling back to the 
existing type otherwise) and passes it into `setWriteDefault`. 
   
   Added the test `TestUnionByNamePromoteDecimalKeepsWiderWriteDefault` for the 
same.
   
   > **Medium — valid complex-type defaults rejected** 
(`table/update_schema.go:767`) New struct/list/map fields with non-null 
`InitialDefault`/`WriteDefault` are rejected, even though the 
metadata-compatibility code accepts complex defaults as JSON object/array 
values (and the new API comment says defaults are preserved). _Fix:_ replace 
the blanket non-primitive rejection with validation matching the repo's 
metadata-compatibility rules for complex defaults.
   
   Done. It now validates `InitialDefault` on the add path as well. Added test 
`TestUnionByNameRejectsMistypedNativeDefault` for the same.


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