Gabriel39 opened a new pull request, #71399:
URL: https://github.com/apache/doris/pull/71399
### Background
Lance catalogs expose versioned columnar datasets and vector/full-text
search through Doris connector plugins. Current master already supplies the
connector SPI, statement snapshot pinning and the native Lance APIs. Several
merged 4.2 changes still need adaptation to that architecture.
### What problem does this PR solve?
Issue Number: #66340, #66516
Related PR: #68707, #69126, #69625, #69852, #69384 (merged source changes
forwarded here)
PR Type: Feature
Problem Summary:
Lance users need historical search, namespace/table/column DDL and
visibility into native cache activity. This ports the remaining merged work
through the existing connector SPI and pinned native ABI. The larger diff
includes deterministic snapshot/index fixtures, mixed-version capability checks
and fixes discovered by local tests and self-review.
### Details
- **Change map:** Production code +1683/-48; tests and fixtures +3166/-96;
generated regression output +280; documentation +104. Binary fixtures account
for much of the 148-file diff.
| Part | Purpose and approximate production size |
| --- | --- |
| Namespace DDL | About 1,040 lines implement mutations, lossless schema
mapping and SHOW CREATE through the existing SPI. |
| Snapshot search | About 180 lines bind historical schemas and
version/time/tag/branch selectors using master's snapshot leases. |
| BE execution and compatibility | About 510 changed lines add cache
observation windows, scalar selection, independent memory capacity,
fixed-snapshot checks and gated approximation modes. |
- **Scope:** Search snapshot selectors, `approx_mode`, cache diagnostics,
automatic scalar index selection, Foyer memory capacity and
namespace/table/column DDL. Filesystem table rename, column
positions/defaults/comments during mutation and combined type/nullability
changes fail explicitly. Unmerged native memory-budget work is outside this
port.
- **Design:** Builds on the design in #66340 and #66516 and the five merged
source PRs. Reuses generic DDL journaling, invalidation and statement leases
rather than restoring source-specific fe-core routing. Request-local
serializers correct the SDK's nullable JSON encoding; filesystem CREATE
properties are stored atomically in the initial Arrow schema because
DirectoryNamespace ignores request properties.
- **Usage:** With a configured Lance catalog, select its database and use:
```sql
CREATE TABLE events (id INT NOT NULL, label STRING NULL) ENGINE=LANCE;
ALTER TABLE events ADD COLUMN score BIGINT NULL;
SHOW CREATE TABLE events;
SELECT row_id FROM vector_search(
'table' = 'lance_catalog.default.items',
'query_vector' = '[0.0, 0.0, 0.0]',
'column' = 'embedding',
'top_k' = '5',
'version' = '1',
'approx_mode' = 'normal'
) ORDER BY row_id;
```
- **Default behavior:** Omitted approximation mode retains NORMAL behavior.
Startup BE option `enable_lance_scalar_index_auto_selection=true` permits
bounded native scalar-index probes. Startup
`lance_data_cache_memory_capacity_bytes=0` preserves one read block of Foyer
memory; positive capacity is independent of block size and must accommodate one
block.
- **Compatibility:** Optional heartbeat field 13 and approximation option
field 6 have no conflicting meaning on branches 3.1, 4.0, 4.1 or 4.2.
FAST/ACCURATE require a fresh positive capability from every candidate BE;
missing, failed or expired heartbeats revoke it. Capability is transient across
images. NORMAL remains compatible, and execution version stays unchanged. No
third-party revision changes. Existing data is unchanged; new externally
persisted DDL remains visible to older clients subject to their type support.
- **Persistence and failure handling:** Existing engine DDL routing retains
its logging/replay and invalidation rules. Each namespace mutation is one SDK
request. Root filesystem registration retries verify location after concurrent
registration. Combined unsupported mutations are rejected before external
writes. Failed profile observations remain visible across readers sharing one
profile.
- **Security and privileges:** Uses existing CREATE/ALTER/DROP
database/table privilege gates and catalog credentials. Mutations issue
additional requests to the configured namespace/storage host; this is an
outbound request surface reachable by users holding the corresponding DDL
privileges. Existing provider endpoint declarations and catalog CREATE/ALTER
checks remain in force. No new privilege or artifact-loading path is added.
- **Behavior change:** EXPLAIN includes snapshot/search context and profiles
include BE-wide cache observation windows. These overlapping windows are not
exact per-query miss totals. Automatic scalar selection is enabled by default
and can be disabled with the startup BE option.
### Testing
Locally, 409 connector tests, 122 focused fe-core tests and 137 focused ASAN
BE tests passed with zero skips. Final changes to the scalar-domain fixture
were rerun successfully. Native tests exercise real DirectoryNamespace DDL,
serializers, snapshot reads and approximation modes; request-contract recording
fakes cover REST mutations.
Eight SQL suites passed with normal golden comparison: DDL, filesystem and
REST snapshot search, legacy vector index, array predicate pushdown, vector
search, REST catalog and REST time travel. All three fixture builders passed
their `--check` validation. New tests reproduced timestamp-precision/decimal
DDL errors and shared-profile availability loss before their respective fixes,
then passed afterward.
### Notes for Reviewers
Native cache misses are shared-session deltas, documented as overlapping
observation windows. Snapshot callbacks run before immutable profile
serialization and stop before dataset destruction, including early LIMIT with a
held native worker. The cached fragment-ID list uses tracked storage. Local SQL
DDL verification used a filesystem namespace; REST mutation verification uses
request-contract tests.
### Release note
Lance adds snapshot-aware search selectors, namespace and table/column DDL,
explicit search approximation modes and cache diagnostics. Scalar index
auto-selection is enabled by default; the Foyer memory tier can be configured
independently of its read block size.
### Check List (For Author)
- Behavior changed: Yes (see Details)
- Does this need documentation: Yes; the cache/index-selection guide is
included. Update the Doris website Lance catalog/search documentation for these
selectors, modes and DDL operations as part of the feature release.
- Pre-submission status: Ready
### AI Disclosure
- Tool: Codex, GPT-6
- Generated: Forward-port adaptations, additional fixes and tests, cache
documentation and this description.
- Human review: not stated
--
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]