viirya opened a new pull request, #3691:
URL: https://github.com/apache/iceberg-rust/pull/3691
## Which issue does this PR close?
- Closes #3690.
## What changes are included in this PR?
Adds `TableScanBuilder::use_ref(name)`, the counterpart of Java's
`SnapshotScan.useRef`. It is the only new public item: the ref map is
crate-private, so callers cannot make the branch/tag schema choice themselves.
- A tag scans its snapshot with that snapshot's schema; a branch, including
`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.
- `build` returns `DataInvalid` for an unknown ref, and when `snapshot_id`
or `as_of_time` is also set, in either order. `snapshot_id` and `as_of_time`
keep their last-call-wins behavior with each other.
## Are these changes tested?
Unit tests in `scan/mod.rs`, using `TableTestFixture` with the tagged
snapshot moved to an older schema: a branch picks its snapshot with the current
schema, `main` picks the current snapshot, a tag uses its snapshot's schema,
`main` on an empty table, an unknown ref, and each conflicting combination.
## AI Disclosure
Written with an AI assistant (Claude). Please check:
- One deliberate difference from Java: Java's `useRef("main")` returns the
scan unchanged, so it can be combined with `useSnapshot`/`asOfTime`. Here any
ref combined with `snapshot_id` or `as_of_time` is an error, including `main`.
- The method name `use_ref` and its `impl Into<String>` argument.
This pull request and its description were written by Isaac.
--
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]