twuebi commented on code in PR #495:
URL: https://github.com/apache/iceberg-go/pull/495#discussion_r2236013333


##########
table/updates.go:
##########
@@ -166,25 +166,21 @@ func (u *upgradeFormatVersionUpdate) Apply(builder 
*MetadataBuilder) error {
 
 type addSchemaUpdate struct {
        baseUpdate
-       Schema       *iceberg.Schema `json:"schema"`
-       LastColumnID int             `json:"last-column-id"`
-       initial      bool
+       Schema  *iceberg.Schema `json:"schema"`
+       initial bool
 }
 
 // NewAddSchemaUpdate creates a new update that adds the given schema and last 
column ID to
-// the table metadata. If the initial flag is set to true, the schema is 
considered the initial
-// schema of the table, and all previously added schemas in the metadata 
builder are removed.
-func NewAddSchemaUpdate(schema *iceberg.Schema, lastColumnID int, initial 
bool) Update {
+// the table metadata.
+func NewAddSchemaUpdate(schema *iceberg.Schema) *addSchemaUpdate {
        return &addSchemaUpdate{
-               baseUpdate:   baseUpdate{ActionName: UpdateAddSchema},
-               Schema:       schema,
-               LastColumnID: lastColumnID,
-               initial:      initial,
+               baseUpdate: baseUpdate{ActionName: UpdateAddSchema},
+               Schema:     schema,
        }
 }

Review Comment:
   Not sure if we do - taking the max of `builder.LastColumnID` and the 
`schema.HighestFieldID()` should have the same effect? As a field within 
`TableUpdate::AddSchema` in the rest-spec it's deprecated:
   
   <img width="370" height="153" alt="image" 
src="https://github.com/user-attachments/assets/70eab856-5f1e-49b2-a73d-e8c80012726b";
 />
   
   
https://editor-next.swagger.io/?url=https://raw.githubusercontent.com/apache/iceberg/main/open-api/rest-catalog-open-api.yaml
   
   The Java API still has the parameter but I'm not sure if that's more due to 
legacy reasons.
   
   Rust add_schema matches this implementation: 
https://github.com/apache/iceberg-rust/blob/d5e83489830eaf88150626cf50158c187dd4faec/crates/iceberg/src/spec/table_metadata_builder.rs#L609-L610



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