Shruthirdy commented on code in PR #2453:
URL: https://github.com/apache/iceberg-go/pull/2453#discussion_r4496014831


##########
table/update_schema.go:
##########
@@ -174,6 +174,15 @@ func NewUpdateSchema(txn *Transaction, caseSensitive bool, 
allowIncompatibleChan
        // referenced by historical schemas.
        u.lastColumnID = meta.LastColumnID()
 
+       // A last-column-id below an ID already in use would hand out a
+       // duplicate field ID. Fail with an error rather than letting
+       // iceberg.NewSchema panic later in Apply.
+       if err := meta.validateLastColumnID(); err != nil {
+               u.err = err
+
+               return u
+       }

Review Comment:
   Thanks for the review @badalprasadsingh, this makes sense. I'll follow the 
pattern from #1988 and start new IDs above both the stored counter and the 
highest ID in any schema, apply the same in `AddSchema` so the written metadata 
stays correct, and remove this check.



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