nandorKollar commented on code in PR #431:
URL: https://github.com/apache/iceberg-go/pull/431#discussion_r2132441587
##########
table/update_schema.go:
##########
@@ -0,0 +1,532 @@
+package table
+
+import (
+ "github.com/apache/iceberg-go"
+)
+
+type UpdateSchema struct {
+ base *Metadata
+ schema *iceberg.Schema
+ idToParent map[int]int
+ deletes []int
+ updates map[int]*iceberg.NestedField
+ parentToAddedIDs map[int][]int
+ addedNameToID map[string]int
+ lastColumnID int
+ allowIncompatibleChanges bool
+ identifierFields map[string]struct{}
+ caseSensitive bool
+}
+
+func NewUpdateSchema(base *Metadata, s *iceberg.Schema, lastColumnID int)
*UpdateSchema {
+ identifierFields := make(map[string]struct{})
+
+ return &UpdateSchema{
+ base: base,
+ schema: s,
+ idToParent: make(map[int]int),
+ deletes: make([]int, 0),
+ updates: make(map[int]*iceberg.NestedField),
+ parentToAddedIDs: make(map[int][]int),
+ addedNameToID: make(map[string]int),
+ lastColumnID: lastColumnID,
+ allowIncompatibleChanges: false,
+ identifierFields: identifierFields,
+ caseSensitive: true,
+ }
+}
+
+// AllowIncompatibleChanges permits incompatible schema changes.
+func (us *UpdateSchema) AllowIncompatibleChanges() *UpdateSchema {
+ us.allowIncompatibleChanges = true
+
+ return us
+}
+
+func (us *UpdateSchema) AddColumn(parent, name string, new_id int, required
bool, dataType iceberg.Type, doc string, initialDefaultValue any) *UpdateSchema
{
+ parentID := -1
Review Comment:
I don't think you need parentID and full name fields here. Eventually they
get a proper value in the if below now? Also, neither of them is used in the
else branch.
--
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]