Repository navigation
Conversation
Member
Author
|
cc @szehon-ho Can you take a look? Thanks! |
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues for the change adding named branch and tag selection to table scans.
No open issues 🎉
What changed in this PR
Adds named branch and tag scanning to TableScanBuilder, addressing #3690 without requiring callers to access private reference metadata.
Changes:
- Adds
use_ref(name), using the current table schema for branches and the snapshot schema for tags. - Rejects unknown references and conflicting snapshot selections, while supporting
mainon empty tables. - Adds unit coverage and records the new method in the public API inventory.
| File | Description |
|---|---|
crates/iceberg/src/scan/mod.rs |
Implements reference selection, schema rules, validation, and unit tests. |
crates/iceberg/public-api.txt |
Records TableScanBuilder::use_ref as a public method. |
Review effort: Balanced
…se_ref Add `TableScanBuilder::use_ref`, matching Java's `SnapshotScan.useRef`. A tag reads with the schema its snapshot was written with; a branch, including `main`, reads with the table's current schema, as `SnapshotUtil.schemaFor(Table, String)` does. `build` returns an error for an unknown ref and when `snapshot_id` or `as_of_time` is also set. Co-authored-by: Isaac <no-reply@databricks.com>
viirya
force-pushed
the
feat-scan-use-ref
branch
from
November 16, 2026 20:09
8950a46 to
004715a
Compare
This branch has not been deployed
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.
Which issue does this PR close?
What changes are included in this PR?
Adds
TableScanBuilder::use_ref(name), the counterpart of Java'sSnapshotScan.useRef. It is the only new public item: the ref map is crate-private, so callers cannot make the branch/tag schema choice themselves.main, scans with the table's current schema (SnapshotUtil.schemaFor(Table, String)).use_ref("main")reads the current snapshot, so it also works on a table with no snapshots.buildreturnsDataInvalidfor an unknown ref, and whensnapshot_idoras_of_timeis also set, in either order.snapshot_idandas_of_timekeep their last-call-wins behavior with each other.Are these changes tested?
Unit tests in
scan/mod.rs, usingTableTestFixturewith the tagged snapshot moved to an older schema: a branch picks its snapshot with the current schema,mainpicks the current snapshot, a tag uses its snapshot's schema,mainon an empty table, an unknown ref, and each conflicting combination.AI Disclosure
Written with an AI assistant (Claude). Please check:
useRef("main")returns the scan unchanged, so it can be combined withuseSnapshot/asOfTime. Here any ref combined withsnapshot_idoras_of_timeis an error, includingmain.use_refand itsimpl Into<String>argument.