RussellSpitzer commented on code in PR #12841:
URL: https://github.com/apache/iceberg/pull/12841#discussion_r2059348242
##########
format/spec.md:
##########
@@ -266,7 +266,18 @@ 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 effective default value is produced by setting each
fields' default in a new struct.
+
+For example, a struct column `point` with fields `x` (default 0) and `y`
(default 0) can be defaulted to `{"x": 0, "y": 0}` or `null`. A non-null
default is stored by setting `initial-default` or `write-default` to an empty
struct (`{}`) that will use field values set from each field's
`initial-default` or `write-default`, respectively.
+
+| `point` default | `point.x` default | `point.y` default | Data value |
Result value |
Review Comment:
This is really helpful. Thank you for adding it!
--
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]