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


##########
table/update_schema.go:
##########
@@ -478,11 +478,16 @@ func (u *UpdateSchema) updateColumn(path []string, update 
ColumnUpdate) error {
                        return fmt.Errorf("cannot update field type for 
non-primitive type: %s", fullName)
                }
                if !update.FieldType.Val.Equals(field.Type) && 
!u.allowIncompatibleChanges {
-                       fieldType, err := iceberg.PromoteType(field.Type, 
update.FieldType.Val)
-                       if err != nil {
-                               return err
+                       from := field.Type.(iceberg.PrimitiveType)
+                       _, fromUnknown := from.(iceberg.UnknownType)
+                       to, toPrimitive := 
update.FieldType.Val.(iceberg.PrimitiveType)
+                       // PromoteType also allows read-time casts (e.g. string 
to binary)

Review Comment:
   nit: this code no longer calls `PromoteType`, so the comment will read oddly 
later. Could it describe the rule itself? For example:
   
   ```go
   // Schema evolution allows only Iceberg type promotions; read-time casts
   // such as string to binary would reinterpret existing data. A v3 unknown
   // column may be promoted to any type.
   ```



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