Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions crates/iceberg/src/metadata_columns.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static COMMIT_SNAPSHOT_ID_FIELD: Lazy<NestedFieldRef> = Lazy::new(|| {
/// This field represents a unique long assigned for row lineage.
static ROW_ID_FIELD: Lazy<NestedFieldRef> = Lazy::new(|| {
Arc::new(
NestedField::required(
NestedField::optional(
RESERVED_FIELD_ID_ROW_ID,
RESERVED_COL_NAME_ROW_ID,
Type::Primitive(PrimitiveType::Long),
Expand All @@ -237,7 +237,7 @@ static ROW_ID_FIELD: Lazy<NestedFieldRef> = Lazy::new(|| {
/// This field represents the sequence number which last updated this row.
static LAST_UPDATED_SEQUENCE_NUMBER_FIELD: Lazy<NestedFieldRef> = Lazy::new(|| {
Arc::new(
NestedField::required(
NestedField::optional(
RESERVED_FIELD_ID_LAST_UPDATED_SEQUENCE_NUMBER,
RESERVED_COL_NAME_LAST_UPDATED_SEQUENCE_NUMBER,
Type::Primitive(PrimitiveType::Long),
Expand Down Expand Up @@ -601,6 +601,15 @@ mod tests {
assert!(get_metadata_field(RESERVED_FIELD_ID_LAST_UPDATED_SEQUENCE_NUMBER).is_ok());
}

#[test]
fn test_row_lineage_metadata_fields_are_optional() {
// The spec requires readers to produce null for these columns in
// legitimate cases (e.g. a data file with a null first_row_id), so the
// fields must be optional rather than required.
assert!(!row_id_field().required);
assert!(!last_updated_sequence_number_field().required);
}

#[test]
fn test_data_table_metadata_columns() {
// Both sides of the data-table metadata check (name and field id) must accept
Expand Down
Loading