lliangyu-lin opened a new pull request, #12401: URL: https://github.com/apache/iceberg/pull/12401
### Description Before this change, ```ViewMetadata.Builder``` did not always retain all view versions added in the current build. This issue was caused by ```int numVersionsToKeep = Math.max(numAddedVersions, historySize)```, which did not account for the case where the current view version was not among the newly added versions, leading to one version from the current build being disregarded (```versionsAddedInCurrentBuildAreRetained``` demonstrated the expected behavior). The fix ensures that: * The current view version and all view versions added in the current build are explicitly retained. * Any remaining versions (up to historySize) are retained in descending order of version ID. ### Testing ```./gradlew spotlessApply``` ```./gradlew :iceberg-core:test --tests "org.apache.iceberg.view.TestViewMetadata"``` Fixes #12113 -- 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: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org