thswlsqls opened a new pull request, #17458: URL: https://github.com/apache/iceberg/pull/17458
## Summary - Backport of #17277 to the Flink 2.0 and 1.20 modules, requested by @pvary on that PR. - `ExpireSnapshots.Builder.config()` passed `ExpireSnapshotsConfig.retainLast()` straight into `retainLast(int)`. That getter returns `null` when the `retain-last` option is unset, so unboxing it threw `NullPointerException` and `config()` was unusable for anyone who left the option out. - `config()` now calls `retainLast()` and `maxSnapshotAge()` only when the config holds a value, keeping the builder defaults otherwise, and drops the then-unused `java.util.Optional` import. - Same diff as d07a574742173bbc43ae2d84d4e7875c4245ebfd on 2.1; the surrounding code was identical, so it applied without adaptation. `ExpireSnapshots.java` and `TestExpireSnapshotsConfig.java` are now byte-identical across 1.20, 2.0 and 2.1. ## Testing done - Backported `TestExpireSnapshotsConfig#configureBuilderWithoutRetainLast`, which asserts `ExpireSnapshots.builder().config(config)` does not throw for a config with no options set. - `:iceberg-flink:iceberg-flink-1.20:test` and `:iceberg-flink:iceberg-flink-2.0:test` with `--tests "*TestExpireSnapshotsConfig*"` — 3 tests passed on each. - Reverting the production change makes the new test fail with the NPE, so it covers the bug. - `spotlessCheck` passes on both modules. --- **AI Disclosure** - Model: Claude Opus 5 - Platform/Tool: Claude Code - Human Oversight: fully reviewed - Prompt Summary: Backport the already-merged fix from #17277 (NPE in `ExpireSnapshots.Builder.config()` when `retain-last` is unset) and its test from the Flink 2.1 module to the Flink 2.0 and 1.20 modules in a single PR, then build and run the affected tests on both versions. -- 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]
