feat: Add Snapshot::into_builder for updating existing snapshots - #3169
Draft
alexanderbianchi wants to merge 1 commit into
Draft
feat: Add Snapshot::into_builder for updating existing snapshots#3169alexanderbianchi wants to merge 1 commit into
alexanderbianchi wants to merge 1 commit into
Conversation
alexanderbianchi
marked this pull request as draft
September 7, 2026 20:21
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What changes are included in this PR?
Add
Snapshot::into_builder()to modify an existing snapshot without manually copying every unchanged field:TableMetadataalready exposes the same conversion: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 aSnapshotUpdateBuilderthat owns the existing snapshot and replaces only explicitly set fields. The existingSnapshot::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, where fixture tests replace snapshot summaries to exercise missing statistics. This review comment 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?
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.cargo public-api -p iceberg --all-features -ss.cargo fmt --all -- --checkandgit diff --check— passed.AI Disclosure
Implementation, tests, and this description were prepared with AI coding assistance.