lucasfang opened a new pull request, #427:
URL: https://github.com/apache/paimon-cpp/pull/427
### Purpose
Linked issue: close #426
A BlobView read resolves the blob table it points at, the dependency table,
in `BlobViewLookup::LoadTableDescriptorChunk`. That read used to borrow the
file system of the downstream read and pass it down through `CatalogContext`,
so the dependency table was authenticated as the downstream table instead of
itself, and a metastore that authorizes per table could not tell them apart.
`BLOB_VIEW_UPSTREAM_WAREHOUSE` was also mandatory, and the lookup probed two
candidate table paths and failed with `Ambiguous table path` when both or
neither existed. This PR reads the dependency table through a catalog of its
own and, on a REST metastore, reports the starting table so the server can
authorize the dependency through that table's owner, mirroring the Java
`CatalogEnvironment.dependencyReadContext()`.
Changes:
- `ReadContextBuilder::Finish` adds a `header.X-Paimon-Read-Via` option when
the read goes through a catalog naming a table and the metastore is `rest`. The
value is the URL-encoded flat JSON `{"database":...,"object":...}` of the
starting identifier, with any branch suffix kept on the object name. An
existing value wins, so a chain of views reports its outermost one.
- `CatalogContext` now carries the `fs_scheme_to_identifier_map` instead of
a `FileSystem`. `BlobViewLookup` creates a catalog from those options with a
null file system, so the dependency table is read under its own credentials,
and uses `catalog->GetTableLocation(identifier)` plus `WithCatalog` on the scan
and read builders. The custom `GetTableLocation` fallback probing is removed.
- `DataEvolutionSplitRead::WrapWithBlobViewResolver` makes
`BLOB_VIEW_UPSTREAM_WAREHOUSE` optional: absent it, it falls back to the
warehouse the downstream table itself lives in, stripping its trailing
`<db>.db/<table>` components, which resolves a co-located upstream table.
- `InternalReadContext` exposes `GetFileSystemSchemeToIdentifierMap` so the
dependency read resolves a non-default scheme the same way the read above it
did.
### Tests
- `src/paimon/core/operation/read_context_test.cpp`:
`TestReadViaHeaderReportsTheStartingTable`,
`TestReadViaHeaderKeepsTheOutermostView`,
`TestReadViaHeaderNeedsARestCatalogAndATable`,
`TestReadViaHeaderReportsTheBranchOfTheStartingTable`.
- `src/paimon/core/operation/internal_read_context_test.cpp`:
`TestHeaderOptionSurvivesIntoCoreOptions`,
`TestFileSystemSchemeMapReachesTheDependencyRead`.
- `test/inte/blob_table_inte_test.cpp`: the upstream warehouse is now
resolved by default, `TestBlobViewFailsWhenBothPathsAbsent` becomes
`TestBlobViewFailsWhenUpstreamTableAbsent`, and the fallback-path and
ambiguous-path cases are dropped.
`ReadContextTest.*` (17 cases) passed locally via `paimon-core-test`.
### API and Format
No storage format or protocol change; the `X-Paimon-Read-Via` header matches
the Java REST protocol. In `include/paimon/` only the doc comment of
`Options::BLOB_VIEW_UPSTREAM_WAREHOUSE` changes, but its behavior changes from
required to optional-with-fallback.
### Documentation
The `Options::BLOB_VIEW_UPSTREAM_WAREHOUSE` doc comment in
`include/paimon/defs.h` is updated to describe the fallback. No new user-facing
feature doc.
### Generative AI tooling
Generated-by: Qoder
--
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]