HonahX commented on code in PR #11948: URL: https://github.com/apache/iceberg/pull/11948#discussion_r1919418195
########## core/src/main/java/org/apache/iceberg/TableMetadataParser.java: ########## @@ -110,6 +110,8 @@ private TableMetadataParser() {} static final String METADATA_LOG = "metadata-log"; static final String STATISTICS = "statistics"; static final String PARTITION_STATISTICS = "partition-statistics"; + static final String ROW_LINEAGE = "row-lineage"; + static final String LAST_ROW_ID = "last-row-id"; Review Comment: In [spec](https://github.com/apache/iceberg/blob/main/format/spec.md?plain=1#L867), this field is `next-row-id`, shall we rename this to make it aligned with the spec? ########## core/src/main/java/org/apache/iceberg/TableMetadata.java: ########## @@ -1230,6 +1265,18 @@ public Builder addSnapshot(Snapshot snapshot) { snapshotsById.put(snapshot.snapshotId(), snapshot); changes.add(new MetadataUpdate.AddSnapshot(snapshot)); + if (rowLineage) { + ValidationException.check( + snapshot.firstRowId() >= lastRowId, + "Cannot add a snapshot whose first-row-id (%s) is less than the metadata `last-used-id` (%s) because this will end up generating duplicate row_ids.", + snapshot.firstRowId(), + lastRowId); + ValidationException.check( + snapshot.addedRows() != null, + "Cannot add a snapshot with a null `addedRows` field when row lineage is enabled"); Review Comment: ```suggestion "Cannot add a snapshot with a null `added-rows` field when row lineage is enabled"); ``` nit: shall we use hyphen to make this consistent with the name in the spec? -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org