thswlsqls opened a new pull request, #17277:
URL: https://github.com/apache/iceberg/pull/17277
Closes #17275
## Summary
- `ExpireSnapshots.Builder.config()` passed the nullable
`ExpireSnapshotsConfig.retainLast()` (`Integer`) to `retainLast(int)`; unboxing
threw `NullPointerException` at `ExpireSnapshots.java:119`.
- `retain-last` has no default — `RETAIN_LAST_OPTION` is
`.intType().noDefaultValue()` and no table property backs it.
`TestExpireSnapshotsConfig` already asserts it is null by default.
- Not an edge case: `IcebergSink.java:813` calls `config()` unconditionally
once `flink-maintenance.expire-snapshots.enabled` is on.
- The setter now runs only when the value is non-null, leaving
`numSnapshots` (already a nullable `Integer`) unset otherwise. Same shape as
the sibling `ConvertEqualityDeletes.Builder.config()`
(`ConvertEqualityDeletes.java:136-144`), which guards its nullable
`scheduleOnIntervalSecond()`.
- `Optional.ofNullable(...).orElse(null)`, used above for `maxSnapshotAge`,
cannot work here: `retainLast` takes a primitive, so `orElse(null)` unboxes and
throws anyway.
- Signatures unchanged; behavior when `retain-last` is set is identical.
```java
Integer retainLast = expireSnapshotsConfig.retainLast();
if (retainLast != null) {
retainLast(retainLast);
}
```
## Testing done
- Added `TestExpireSnapshotsConfig#configureBuilderWithoutRetainLast`,
feeding a default config into `ExpireSnapshots.builder().config(...)`. Fails
with the NPE above without the fix, passes with it.
- `:iceberg-flink:iceberg-flink-2.1:test` over `TestExpireSnapshotsConfig`,
`TestExpireSnapshots`, `TestConvertEqualityDeletesConfig` — 10 tests, 0
failures.
- `spotlessCheck`, `checkstyleMain`, `checkstyleTest` passed. Module-wide
`:check` not run to completion locally (many MiniClusters); left to CI.
--
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]