tgorthi commented on issue #13850:
URL: https://github.com/apache/iceberg/issues/13850#issuecomment-3218790902

   I will try to write a test case to reproduce the issue.
   In our code, we trigger updateSchema within a transaction, re-write some 
files and commit the transactions, something like below:
   
   ```
   var icebergTransaction = icebergTable.newTransaction();
   var updateIcebergSchema = icebergTransaction.updateSchema();
   
   updateSchema.deleteColumn(dropColumn);
   updateIcebergSchema.commit();
   
   //re-write some files
   
   var overwriteFiles = icebergTransaction.newOverwrite();
   filesToDelete.forEach(overwriteFiles::deleteFile);
   filesToAdd.forEach(overwriteFiles::addFile);
   
   overwriteFiles.commit();
   icebergTransaction.commitTransaction();
   
   ```
   the final `commitTransaction()` calls `MetadataUpdate#AddSchema` which tries 
to get the `lastColumnId()` and instead of returning the lastColumnId, we 
return the `highestFieldId()` which has already been reduced to 1 and the 
validation fails.
   
   <img width="984" height="231" alt="Image" 
src="https://github.com/user-attachments/assets/65837b0e-44e6-4b72-b41a-0b88d59fd1bc";
 />
   
   Stack trace:
   
   <img width="1139" height="650" alt="Image" 
src="https://github.com/user-attachments/assets/48a080fe-b9a2-46ab-b903-1127cec32aa0";
 />
   


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