alexanderbianchi opened a new pull request, #3169: URL: https://github.com/apache/iceberg-rust/pull/3169
## What changes are included in this PR? Add `Snapshot::into_builder()` to modify an existing snapshot without manually copying every unchanged field: ```rust let updated = snapshot.into_builder().with_summary(summary).build(); ``` [`TableMetadata` already exposes the same conversion](https://github.com/apache/iceberg-rust/blob/28ede505/crates/iceberg/src/spec/table_metadata.rs#L152): ```rust let builder = metadata.into_builder(None); ``` That delegates to `TableMetadataBuilder::new_from_metadata(metadata, None)`. Snapshots currently have only a builder for constructing a new value, so even replacing a summary requires repeating IDs, sequence number, timestamp, manifest location, and other fields. `into_builder()` returns a `SnapshotUpdateBuilder` that owns the existing snapshot and replaces only explicitly set fields. The existing `Snapshot::builder()` and its compile-time required-field checks are unchanged: its typed builder does not permit overwriting populated fields, so it cannot serve as an editing builder directly. No dependencies or serialization changes. ## Motivation Use case: [DataFusion Distributed #700](https://github.com/datafusion-contrib/datafusion-distributed/pull/700), where fixture tests replace snapshot summaries to exercise missing statistics. [This review comment](https://github.com/datafusion-contrib/datafusion-distributed/pull/700#discussion_r3951809665) highlights the resulting snapshot-reconstruction boilerplate. This constructs a snapshot value only; table metadata updates and their snapshot-ID/sequence-number validation remain unchanged. ## Are these changes tested? - Unit test covers an unchanged round trip, replacing only the summary while preserving all other fields (including encryption and row lineage), field overrides, and clearing optional IDs. - `cargo test -p iceberg --lib --locked` — 1,675 passed. - `cargo test -p iceberg --doc into_builder --locked` — passed. - `cargo clippy -p iceberg --lib --tests --all-features --locked -- -D warnings` — passed. - Public API snapshot regenerated with `cargo public-api -p iceberg --all-features -ss`. - `cargo fmt --all -- --check` and `git diff --check` — passed. ## AI Disclosure Implementation, tests, and this description were prepared with AI coding assistance. -- 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]
