RussellSpitzer commented on code in PR #12841:
URL: https://github.com/apache/iceberg/pull/12841#discussion_r2059276361
##########
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:
We went through some more examples on slack and I think some of those would
be helpful here as well.
IE Given initial defaults of .....
An null value would have an actual/effective value of ....
An empty struct would have a value of
A struct with x defined would have a value of
--
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]