rzhang10 commented on code in PR #4301: URL: https://github.com/apache/iceberg/pull/4301#discussion_r862090954
########## format/spec.md: ########## @@ -227,6 +223,15 @@ Any struct, including a top-level schema, can evolve through deleting fields, ad Grouping a subset of a struct’s fields into a nested struct is **not** allowed, nor is moving fields from a nested struct into its immediate parent struct (`struct<a, b, c> ↔ struct<a, struct<b, c>>`). Evolving primitive types to structs is **not** allowed, nor is evolving a single-field struct to a primitive (`map<string, int> ↔ map<string, struct<int>>`). +Struct evolution requires the following rules for default values: +* The `initial-default` must be set when a field is added and cannot change +* The `write-default` must be set when a field is added and may change +* When a required field is added, both defaults must be set to a non-null value +* When an optional field is added, the defaults may be null and should be explicitly set +* When a new field is added to a struct with a default value, the default should be updated to include the new field's default Review Comment: I think from an implementation standpoint, propagating the default update to the whole schema tree could be a bit tricky to implement. I feel the approach of only updating the default at its own level, and delaying the recovery of defaults to access time should be fine? As long as we always traverse/honor the default value defined at deeper levels? Or do you think updating the defaults of an outer struct should also overwrite the default of an inner child field if it has its own default defined? -- 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]
