akashmalbari opened a new pull request, #18382: URL: https://github.com/apache/iceberg/pull/18382
## Summary `MetricsConfig` is immutable, but `metricsFieldIds()` currently returns the live key set of its mutable, Kryo-serializable backing map. A caller can remove an ID through the returned iterator, which changes subsequent field ID iteration and mode lookup. This returns an unmodifiable set view while leaving the internal `SerializableMap` unchanged, preserving schema order and Kryo serialization. A regression test verifies that iterator removal is rejected and the ordered IDs remain unchanged. ## Test plan The focused regression test must reject `Iterator.remove()` because allowing it mutates later results. After that rejection, it verifies that all field IDs are still present in schema order. The test failed on unmodified `main` and passed with this change. - `./gradlew spotlessApply :iceberg-core:checkstyleMain :iceberg-core:checkstyleTest :iceberg-core:test --tests org.apache.iceberg.TestMetricsConfig` - `./gradlew :iceberg-core:build` -- 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]
