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


##########
format/spec.md:
##########
@@ -1653,6 +1656,53 @@ If a delete column in an equality delete file is later 
dropped from the table, i
 
 Manifests hold the same statistics for delete files and data files. For delete 
files, the metrics describe the values that were deleted.
 
+### Column Files
+
+Starting in v4, some fields of a data file can be stored in separate column 
files, listed in the data file's [`column_files`](#column-file-fields), in 
addition to the data file itself. This section describes column files for data 
files.
+
+In this section:
+
+- The **previous entry** is the live entry of the data file before column 
files are added.
+- An **updated field** is a field whose ID is in the `field_ids` of an added 
column file.
+- An **updated row** is a row whose updated-field values were set by the 
update. Other rows keep their current values.
+
+A column file is a valid Iceberg data file: files must use valid Iceberg 
formats, schemas, and column projection.
+
+A column file must have the same row count as its data file.
+
+A column file stores the entire value of each field whose ID is in its 
`field_ids`. Each ID in `field_ids` must be the ID of a top-level field in the 
table schema used to write the column file, or the ID of a row lineage field 
required by [Adding Column Files](#adding-column-files). The `field_ids` of a 
column file may overlap with the field IDs of the data file. Which file a field 
is read from is determined by [Reading Column Files](#reading-column-files).
+
+#### Reading Column Files
+
+A projected field whose top-level field ID is in a column file's `field_ids`, 
including `_last_updated_sequence_number`, must be read from that column file. 
All other projected fields are read from the data file using [Column 
Projection](#column-projection).
+
+Row `i` of a column file corresponds to row `i` of the data file. Column files 
and the data file are combined by row position before the deletion vector is 
applied. Readers must ignore top-level fields in a column file whose IDs are 
not in its `field_ids`. A null value in a column file does not indicate that a 
row is deleted.
+
+#### Adding Column Files
+
+When column files are added to a data file, the writer must produce a MODIFIED 
entry and a REPLACED entry as described in [Updating Tracking 
Metadata](#updating-tracking-metadata). The MODIFIED entry and the REPLACED 
entry may be written to different manifests.
+
+A new column file stores the value of each of its listed fields for every row 
of the data file, including rows the update did not change. Values in rows 
deleted by the MODIFIED entry's `deletion_vector` should be null, so a 
top-level field must be optional in the column file's schema if the column file 
stores null for it. For a top-level field that is required in the table schema, 
a non-null value must be stored in every row that is not deleted by the 
MODIFIED entry's `deletion_vector`.
+
+The `tracking` fields of the MODIFIED entry are set as described in [Updating 
Tracking Metadata](#updating-tracking-metadata) and [Sequence Number 
Inheritance](#sequence-number-inheritance), and `tracking.snapshot_id` must be 
the previous entry's (inherited) snapshot ID. The other fields of the MODIFIED 
entry must match the previous entry, except for the following:
+
+- `spec_id` and `partition`:
+    - If an updated field is, or contains, a source field of the partition 
spec, `spec_id` and `partition` must be null.
+- `sort_order_id`:
+    - If an updated field is, or contains, a field in the sort order, 
`sort_order_id` must be null.
+- `content_stats`:
+    - Stats for each updated field, including its nested fields, must be 
computed from the values in the column file that has its ID in `field_ids`, or 
omitted. Stats for other fields may be kept.
+- `deletion_vector`:

Review Comment:
   Oh, I see. But this isn't true in all cases. It is possible to update all 
rows without changing the deletion vector.
   
   That's why statements like this should not be made. This is not something 
that is required to be updated. The requirement is that the metadata is 
correct. So this should focus on what is _correct_, not what must change.



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