stevenzwu commented on code in PR #18526:
URL: https://github.com/apache/iceberg/pull/18526#discussion_r4807499765


##########
format/spec.md:
##########
@@ -1248,6 +1245,25 @@ Inheriting sequence numbers through the metadata tree 
allows writing a new manif
 
 Inheritance does not apply to v1, which does not have inherited fields like 
sequence number. When reading v1 manifests with no sequence number column, 
sequence numbers for all files must default to 0.
 
+##### Snapshot Timestamp Inheritance

Review Comment:
   Good catch on the pre-v4 case. I added a sentence that follows the 
`first_row_id` inheritance wording: any null `snapshot_timestamp` must be 
inherited, even for `EXISTING` entries, so files in pre-v4 manifests get a 
timestamp after the upgrade. I kept the read rule ungated, like `first_row_id`, 
rather than gating it on status and then adding an exception. The writer rules 
already mean only ADDED and MODIFIED entries can be null in v4 manifests.



##########
format/spec.md:
##########
@@ -1248,6 +1245,25 @@ Inheriting sequence numbers through the metadata tree 
allows writing a new manif
 
 Inheritance does not apply to v1, which does not have inherited fields like 
sequence number. When reading v1 manifests with no sequence number column, 
sequence numbers for all files must default to 0.
 
+##### Snapshot Timestamp Inheritance
+
+The `snapshot_timestamp` tracking field records the `timestamp-ms` of the 
snapshot that added or last modified a file's data, converted to microseconds. 
It is used to assign `_last_updated_timestamp` for [row lineage](#row-lineage).
+
+When writing a leaf manifest, writers must set `snapshot_timestamp` as follows:
+
+* ADDED entries must set the value to `null` (inherit).
+* MODIFIED entries must set the value to `null` when data in live rows is 
updated (e.g. adding a column file).
+* MODIFIED entries must preserve the original non-null value if data in live 
rows is not changed (e.g. updating the file's DV).
+* Any other entry written to a new manifest must have a non-null 
`snapshot_timestamp` (inherited or previously persisted).
+
+Entries in the root manifest must have a non-null `snapshot_timestamp`:
+
+* ADDED entries must set it to the snapshot's `timestamp-ms` converted to 
microseconds.
+* MODIFIED entries must set it to the snapshot's timestamp when data in live 
rows is updated, and preserve the original value otherwise.
+* Any other entry must preserve the original value.
+
+When reading a leaf manifest, `snapshot_timestamp` is inherited by replacing 
`null` with the `snapshot_timestamp` of the leaf manifest's entry in the root 
manifest. This includes manifests written before v4 once they are listed in a 
root manifest; see [Row Lineage for Upgraded 
Tables](#row-lineage-for-upgraded-tables).

Review Comment:
   Thanks for the suggestion. I added the pre-v4 part in a form that follows 
the `first_row_id` wording, and kept the read rule ungated. More details in the 
other thread.



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