wangyong9999 opened a new pull request, #277:
URL: https://github.com/apache/paimon-cpp/pull/277
### Purpose
Linked issue: N/A
Repeated latest-snapshot batch scans currently resolve and parse the table
schema, `LATEST` hint,
and snapshot JSON again. This is especially expensive for point-lookup
engines, while a
process-global cache in paimon-cpp would impose freshness and lifecycle
policy on every caller.
This change adds a caller-owned, immutable `SnapshotReadView` handoff:
`Plan -> SnapshotReadView -> ScanContextBuilder -> SnapshotReader`
The view retains the parsed snapshot and table schema, is bound to one
normalized table path and
branch, and has no global state, TTL, stale-read policy, singleflight, or
quota policy. It is only
published and accepted for non-streaming, non-real-time `latest` /
`latest-full` batch scans,
including the read-optimized (`$ro`) path. Empty-table views are reusable as
well.
For data-evolution global-index scans, an internally evaluated index
captures the view before the
index lookup and the data scan consumes the same view, so row ids and data
are planned against one
snapshot. A caller-supplied `GlobalIndexResult` keeps its legacy behavior
unless the caller also
supplies the matching view; paimon-cpp does not invent snapshot provenance
for an external result.
The existing `ReadContext::SetTableSchema` path is also honored by
system-table reads, allowing a
`$ro` reader to reuse its caller-provided parsed schema instead of loading
it again.
### Tests
- `pre-commit` on all changed files and `git diff --check`
- CMake/Ninja build of `paimon-core-test` and `paimon-global-index-test`
- `TableScanTest.*:SnapshotReaderTest.*` (17 tests)
- `FileFormat/GlobalIndexTest.TestDataEvolutionBatchScan/*` (6 tests)
- The same focused core tests (17 tests) and internal global-index
integration variants (4 tests)
with the downstream Blade/GCC 8.3 build
### API and Format
This adds the public `SnapshotReadView`, `Plan::GetSnapshotReadView()`, and
`ScanContextBuilder::WithSnapshotReadView()` APIs. Existing source
implementations remain
compatible because `Plan::GetSnapshotReadView()` has a default
implementation. Consumers using a
prebuilt shared library must rebuild against the matching headers because
`Plan`'s vtable and
`ScanContext`'s layout change.
There is no storage-format, file-format, or wire-protocol change.
### Documentation
The new public API and its supported scan boundary are documented in the
public headers. No new
configuration option is introduced.
### Generative AI tooling
Generated-by: Codex (GPT-5)
--
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]