stevenzwu commented on code in PR #16777:
URL: https://github.com/apache/iceberg/pull/16777#discussion_r4254863762
##########
format/spec.md:
##########
@@ -1676,14 +1683,14 @@ Types are serialized according to this table:
|**`fixed(L)`**|`JSON string: "fixed[<L>]"`|`"fixed[16]"`|
|**`binary`**|`JSON string: "binary"`|`"binary"`|
|**`decimal(P, S)`**|`JSON string: "decimal(<P>,<S>)"`|`"decimal(9,2)"`,<br
/>`"decimal(9, 2)"`|
-|**`struct`**|`JSON object: {`<br /> `"type": "struct",`<br
/> `"fields": [ {`<br /> `"id": <field id
int>,`<br /> `"name": <name string>,`<br
/> `"required": <boolean>,`<br
/> `"type": <type JSON>,`<br
/> `"doc": <comment string>,`<br
/> `"initial-default": <JSON encoding of default
value>,`<br /> `"write-default": <JSON encoding of
default value>`<br /> `}, ...`<br /> `]
}`|`{`<br /> `"type": "struct",`<br /> `"fields": [ {`<br
/> `"id": 1,`<br /> `"name":
"id",`<br /> `"required": true,`<br
/> `"type": "uuid",`<br
/> `"initial-default":
"0db3e2a8-9d1d-42b9-aa7b-74ebe558dceb",`<br
/> `"write-default": "ec5911be
-b0a7-458c-8438-c9a3e53cffae"`<br /> `}, {`<br
/> `"id": 2,`<br /> `"name":
"data",`<br /> `"required": false,`<br
/> `"type": {`<br
/> `"type": "list",`<br
/> `...`<br /> `}`<br
/> `} ]`<br />`}`|
Review Comment:
this is hard to review. what is the change here?
##########
format/spec.md:
##########
@@ -330,7 +331,15 @@ 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`, `variant`, `geometry`, and `geography` types must
default to null. Non-null values for `initial-default` or `write-default` are
invalid.
+Starting in v4, a field's `write-default` may be a [value
expression](expressions-spec.md) rather than a literal. This allows defaults
such as `current_timestamp()` to be evaluated when a row is written. A value
expression `write-default` is subject to the following requirements:
+
+* The expression must be a constant or a function application (apply); [field
references](expressions-spec.md#field-reference) (bound or unbound) are not
allowed in a default value expression
Review Comment:
this might have been discussed before. what is the reason that field
references are not allowed? read may not know additional field need to be
projected?
--
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]