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


##########
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 thought about this a bit more and changed the wording to this:
   > When a new field is added to a struct with a default value, updating the 
struct's default is optional
   
   It is up to the writer whether to update the default. If the write default 
for the field changes, then not updating the value means not needing to change 
the struct's default as well. Not requiring this will probably give more 
expected behavior, but still allow people to set the default explicitly.



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