zeroshade commented on code in PR #659:
URL: https://github.com/apache/iceberg-go/pull/659#discussion_r2641335849
##########
table/metadata.go:
##########
@@ -435,6 +441,42 @@ func (b *MetadataBuilder) AddSnapshot(snapshot *Snapshot)
error {
return nil
}
+func (b *MetadataBuilder) validateAndUpdateRowLineage(snapshot *Snapshot)
error {
+ if b.formatVersion < minFormatVersionRowLineage {
+ return nil
+ }
+
+ if err := snapshot.ValidateRowLineage(); err != nil {
+ return err
+ }
+
+ if snapshot.FirstRowID == nil {
+ return fmt.Errorf("%w: first-row-id is required for v3
snapshots", ErrInvalidRowLineage)
+ }
+
+ nextRowID := b.currentNextRowID()
+ if *snapshot.FirstRowID < nextRowID {
+ return fmt.Errorf("%w: first-row-id %d is behind table
next-row-id %d",
+ ErrInvalidRowLineage, *snapshot.FirstRowID, nextRowID)
+ }
+
+ newNextRowID := nextRowID + *snapshot.AddedRows
Review Comment:
is `AddedRows` required in v3? or is this a potential nil-dereference panic?
--
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]