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


##########
format/spec.md:
##########
@@ -266,7 +266,11 @@ The `initial-default` is set only when a field is added to 
an existing schema. T
 
 The `initial-default` and `write-default` produce SQL default value behavior, 
without rewriting data files. SQL default value behavior when a field is added 
handles all existing rows as though the rows were written with the new field's 
default value. Default value changes may only affect future records and all 
known fields are written into data files. Omitting a known field when writing a 
data file is never allowed. The write default for a field must be written if a 
field is not supplied to a write. If the write default for a required field is 
not set, the writer must fail.
 
-All columns of `unknown`, `geometry`, and `geography` types must default to 
null. Non-null values for `initial-default` or `write-default` are invalid.
+All columns of `unknown`, `variant`, `geometry`, and `geography` types must 
default to null. Non-null values for `initial-default` or `write-default` are 
invalid.
+
+Default values for the fields of a struct are tracked as `initial-default` and 
`write-default` at the field level. Default values for fields that are nested 
structs must not contain default values for the struct's fields (sub-fields). 
Sub-field defaults are tracked in sub-field's metadata. As a result, the 
default stored for a nested struct may be either null or a non-null struct with 
no field values. The actual default value is produced by setting each field 
default in a new struct.
+
+For example, a column `point` with fields `x` (default 0) and `y` (default 0) 
can be defaulted to `{"x": 0, "y": 0}` or `null`. The values stored for 
`initial-default` and `write-default` may be either `null` or an empty struct 
(`{}`) that indicates a non-null struct with field values set from each field's 
`initial-default` or `write-default`, respectively.

Review Comment:
   I wouldn't use "sub-fields" because this is using "column" for the struct 
and fields for the struct's nested fields. I think that's clear enough.
   
   Changing the sentence to use "would" seems to be more strict than I think it 
should be, but I can change to "A non-null default is stored by setting 
`initial-default` or `write-default` to an empty struct".



-- 
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: issues-unsubscr...@iceberg.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org
For additional commands, e-mail: issues-h...@iceberg.apache.org

Reply via email to