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


##########
format/spec.md:
##########
@@ -1748,7 +1752,9 @@ The rows in the delete file must be sorted by `file_path` 
then `pos` to optimize
 
 Equality delete files identify deleted rows in a collection of data files by 
one or more column values, and may optionally contain additional columns of the 
deleted row.
 
-Equality delete files must not be added to v4 tables. Equality deletes cannot 
be added as an entry to a v4 manifest. Equality delete files referenced by v2 
or v3 delete manifests must still be applied in a v4 table.
+Equality delete files must not be added to v4 tables and cannot be written to 
new v4 leaf manifests. Equality delete files tracked by existing v2 or v3 
delete manifests must still be applied in a v4 table.

Review Comment:
   It looks unnecessary to add `and cannot be written to new v4 leaf manifests`.



##########
format/spec.md:
##########
@@ -1801,6 +1807,58 @@ 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
+
+In v4 and later, a data file or leaf manifest tracked in `tracked_file` may 
store fields in column files listed in [`column_files`](#column-file-fields). 
The `tracked_file` is referred to as the _base file_.
+
+A column file can use any supported Iceberg file format and must have the same 
row count as its base file. Its rows are aligned with the base file's rows by 
position, including deleted rows.
+
+A column file stores fields identified by field ID. Column files must store 
field IDs, and name mapping does not apply to them. If a field's ID is in a 
column file's `field_ids`, that column file is _responsible_ for the field and 
all fields nested in it unless a nested field is in a different `field_ids` 
list. The base file is responsible for every field that no column file is 
responsible for. A field ID may be in the `field_ids` of at most one column 
file. `_row_id` must not be in any column file's `field_ids`. For example, a 
column file with `field_ids = [3, 5]`, where both fields are primitive, is 
responsible for fields 3 and 5.
+
+List, map, and file type fields are identified by their own ID and must be 
fully contained in the base file or a single column file. IDs of fields nested 
in these types, such as a list's element ID or a map's key ID, or any nested 
struct field IDs, must not be in `field_ids`. For example, for `8: tags list<9: 
string>`, `field_ids` may have 8 but not 9.
+
+When a struct's ID is in a column file's `field_ids`, the ID of a field nested 
in it may be in another column file's `field_ids`. That column file is then 
responsible for the nested field instead. For example, for `4: address 
struct<5: street, 6: city>`, if one column file stores all of `address` with 
`field_ids = [4]` and another's is `[5]`, the second file is responsible for 
`street` and the first for `address` and `city`.
+
+Every file that is responsible for part of a struct, including the base file, 
must store the same null state for that struct in each row. For example, for 
`4: address struct<5: street, 6: city>`, if one column file's `field_ids` is 
`[4]` and another's is `[5]`, and the first stores `address` as null in a row, 
the second must also store `address` as null in that row. If an update changes 
a struct from null to non-null (or vice versa), all fields of the struct must 
be replaced by new column files.
+
+#### Writing Column Files
+
+A column file stores a value for every row of its base file, including rows 
whose values did not change. Values for deleted rows should be null. A column 
file may write a field as optional even if that field is required in the table 
schema.

Review Comment:
   Should we mention how readers should behave when a live row has been written 
as null for a required column?



##########
format/spec.md:
##########
@@ -1801,6 +1807,65 @@ 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
+
+In v4 and later, a data file or leaf manifest may store fields in column files 
listed in [`column_files`](#column-file-fields). The data file or leaf manifest 
whose `column_files` lists a column file is that column file's _base file_.
+
+A column file can use any supported Iceberg file format and must have the same 
row count as its base file. Its rows are aligned with the base file's rows by 
position, including deleted rows.

Review Comment:
   Should we say `any supported Iceberg file format as per the format version`?



##########
format/spec.md:
##########
@@ -157,6 +157,7 @@ Version 4 of the Iceberg spec adds support for relative 
locations in metadata, e
 * **Delete manifest** -- A file that lists delete files to be associated with 
data files at planning time.
 * **Data file** -- A file that contains rows of a table.
 * **Delete file** -- A file that encodes rows of a table that are deleted by 
position or data values.
+* **Column file** -- A file that stores a set of fields that replace or are 
added to fields in a data or leaf manifest file.

Review Comment:
   Not a native speaker but I find this sentence a little confusing. Should we 
rephrase it like `A file that stores replacement or additional fields for a 
data file or a leaf manifest file`?



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