zeroshade commented on code in PR #596:
URL: https://github.com/apache/iceberg-go/pull/596#discussion_r2445854684


##########
table/transaction.go:
##########
@@ -147,6 +147,10 @@ func (t *Transaction) UpdateSpec(caseSensitive bool) 
*UpdateSpec {
        return NewUpdateSpec(t, caseSensitive)
 }
 
+func (t *Transaction) UpdateSchema(caseSensitive bool, 
allowIncompatibleChanges bool, opts ...UpdateSchemaOption) *UpdateSchema {

Review Comment:
   Add a docstring here



##########
table/update_schema.go:
##########
@@ -0,0 +1,884 @@
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements.  See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership.  The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License.  You may obtain a copy of the License at
+//
+//   http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied.  See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+package table
+
+import (
+       "errors"
+       "fmt"
+       "maps"
+       "slices"
+       "strings"
+
+       "github.com/apache/iceberg-go"
+)
+
+const TableRootID = -1
+
+type MoveOp string
+
+const (
+       MoveOpFirst  MoveOp = "first"
+       MoveOpBefore MoveOp = "before"
+       MoveOpAfter  MoveOp = "after"
+)
+
+type move struct {
+       FieldID    int
+       RelativeTo int
+       Op         MoveOp
+}
+
+type UpdateSchema struct {
+       txn          *Transaction
+       schema       *iceberg.Schema
+       lastColumnID int
+
+       deletes map[int]struct{}
+       updates map[int]map[int]iceberg.NestedField
+       adds    map[int][]iceberg.NestedField
+       moves   map[int][]move
+
+       identifierFieldNames map[string]struct{}
+       parentID             map[int]int
+
+       addedNameToID            map[string]int
+       allowIncompatibleChanges bool
+       caseSensitive            bool
+       nameMapping              iceberg.NameMapping
+       ops                      []func() error
+}
+
+type UpdateSchemaOption func(*UpdateSchema)
+
+func WithNameMapping(nameMapping iceberg.NameMapping) UpdateSchemaOption {
+       return func(u *UpdateSchema) {
+               u.nameMapping = nameMapping
+       }
+}
+
+func NewUpdateSchema(txn *Transaction, caseSensitive bool, 
allowIncompatibleChanges bool, opts ...UpdateSchemaOption) *UpdateSchema {

Review Comment:
   This and the options need doc strings



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