mrdrivingduck opened a new pull request, #425:
URL: https://github.com/apache/paimon-cpp/pull/425
### Purpose
Expose `Catalog::GetLatestSnapshot()` so catalog clients can retrieve the
latest snapshot metadata, including its snapshot ID and schema ID, without
loading the full snapshot history or planning a scan.
The filesystem implementation reuses `SnapshotManager::LatestSnapshot()`,
including its existing latest-snapshot hint and filename-listing fallback. The
REST implementation uses the existing current-snapshot endpoint. Neither
implementation calls `ListSnapshots()`. Tables without snapshots return an
empty optional; branch selection and missing-table behavior follow the existing
behavior of each catalog.
### Tests
A clean Debug build of `paimon-core-test` and `paimon-rest-test` passed with
REST enabled, bundled dependencies, and ccache disabled.
- All 4 new tests passed: latest snapshot metadata, no snapshot, branch
selection, and missing objects. Filesystem tests reuse checked-in fixtures;
REST tests reuse the existing mock server.
- All 96 related regression tests passed: filesystem catalog, REST catalog,
snapshot manager, and snapshot metadata conversion.
- Pre-commit checks passed for all 8 changed files; the diff whitespace
check passed.
Test filters:
```text
FileSystemCatalogTest.TestGetLatestSnapshot*
RestCatalogTest.GetLatestSnapshot*
FileSystemCatalogTest.*:SnapshotManagerTest.*:SnapshotTest.TestToSnapshotInfo-FileSystemCatalogTest.TestGetLatestSnapshot*
RestCatalogTest.*-RestCatalogTest.GetLatestSnapshot*
```
The full project test suite was not run.
### API and Format
Add a pure virtual method to the public catalog API:
```cpp
virtual Result<std::optional<SnapshotInfo>> GetLatestSnapshot(
const Identifier& identifier, const std::string& branch = "") const = 0;
```
Filesystem, REST, and mock catalog implementations are updated. Other
catalog subclasses must provide an override. Storage formats and REST protocol
are unchanged.
### Documentation
The public API is documented inline in the catalog header. No separate
documentation or README changes are included.
### Generative AI tooling
Generated-by: OpenAI Codex (GPT-6.1 Sol).
--
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]