ShivamSharma43 commented on code in PR #2646:
URL: https://github.com/apache/iceberg-go/pull/2646#discussion_r4644604613


##########
table/update_schema.go:
##########


Review Comment:
   Fixed in 44ff0fa: BuildUpdates now writes `[]` when UpdateNameMapping 
returns nil. Added TestUpdateSchemaKeepsEmptyNameMappingValid, which covers 
rename and delete on `[]` and on entries with empty names, and checks the 
property stays valid. It fails without the fix with `invalid 
schema.name-mapping.default`.



##########
table/update_schema.go:
##########
@@ -1129,12 +1131,19 @@ func (u *UpdateSchema) BuildUpdates() ([]Update, 
[]Requirement, error) {
                        )
                }
 
-               if u.nameMapping != nil {
+               // Keep the table's name mapping in step with the schema, as 
Java's
+               // SchemaUpdate and PyIceberg's UpdateSchema do. Otherwise 
files without
+               // field IDs cannot be resolved for added or renamed columns.
+               nameMapping := u.nameMapping
+               if nameMapping == nil {
+                       nameMapping = meta.NameMapping()

Review Comment:
   Added an unreleased compatibility note in website/src/releases.md (44ff0fa) 
covering the mapping rewrite and the reused-name case for older files without 
field IDs.



##########
table/update_schema_name_mapping_test.go:
##########


Review Comment:
   Moved the tests into update_schema_test.go and removed 
update_schema_name_mapping_test.go in 44ff0fa. They reuse the existing 
countingCatalog.



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