Skip to content

[doc](lance) document multi-vector search usage and limits - #4148

Merged
Gabriel39 merged 1 commit into
apache:masterfrom
Gabriel39:dev/lance-multivector-docs
Sep 18, 2026
Merged

Gabriel39 merged 1 commit into
apache:masterfrom
Gabriel39:dev/lance-multivector-docs

Conversation

@Gabriel39

Copy link
Copy Markdown
Contributor

Document how to query a Lance multi-vector column with vector_search(), including data preparation, expected results, scoring, index usage, and parameter limits in the English and Chinese 4.x Lance Catalog guides.

Depends on apache/doris#68028; merge the documentation with or after that implementation. Related feature request: apache/doris#66494.

The guide explains supported Arrow types and nullability, row-level L2/cosine/dot scoring, matrix dimensions, the 128-subvector limit, both 100,000-candidate budgets, mandatory multi-vector refinement, and cosine index usage. It also corrects the metric/refinement defaults and reader versions to match the implementation.

Versions

  • dev
  • 4.x
  • 3.x
  • 2.1 or older (not covered by version/language sync gate)

The Dev Lance Catalog pages were deliberately removed in #4086. This change updates the existing 4.x pages without restoring those pages or advertising support in older releases. This explains the existing missing-current-counterpart warning from the locale/version check.

Languages

  • Chinese
  • English

Validation

  • Reviewed the complete diff against the FE parameter validation and Lance C multi-vector scoring implementation.
  • Compiled both changed MDX files with GFM/front matter support and normalized Docusaurus explicit heading IDs.
  • Changed-file link and feature checks: no errors. The external Lance object-store documentation was checked separately.
  • Verified that both locales contain identical executable examples. Executed the data builder using pylance 11.0.0 with temporary local storage, then checked the documented basic, offset, and prefilter results through the patched Lance C scanner, including empty/null outer rows.
  • git diff --check passed.
  • No full-site build or new live Doris SQL run. SEO checks reported only existing metadata warnings; no metadata is changed.

Docs Checklist

  • Checked by AI
  • Test Cases Built
  • Updated required version and language counterparts, or explained why not
  • If only one language changed, confirmed whether source/translation counterparts need sync

@Gabriel39
Gabriel39 force-pushed the dev/lance-multivector-docs branch from 29874cd to b89ac44 Compare September 18, 2026 06:03
@Gabriel39
Gabriel39 merged commit 3e0d5d9 into apache:master Sep 18, 2026
3 checks passed
Gabriel39 added a commit to apache/doris that referenced this pull request Sep 18, 2026
### What problem does this PR solve?

Issue Number: close #66494

`vector_search` accepts one query matrix for a Lance
`List<FixedSizeList<T, D>>` column on branch-4.1, supporting Float16,
Float32 and Float64. A matrix such as `[[1,0],[0,1]]` ranks logical rows
containing variable numbers of subvectors. The row score is `sum(q in
query, min(v in row, distance(q, v)))`; the TVF filter precedes
candidate selection, and TopK/offset count rows.

The Lance-C adapter computes scores before candidate truncation,
preserving small L2 differences and aggregating each ANN query child
across all output batches. Indexed candidates undergo exact refinement,
and fragment-scoped results regain distance order before limit/offset.
ANN candidate selection remains approximate. Omitted metrics resolve
consistently to L2 on every split, including partially indexed datasets.
The pinned Lance version supports cosine multi-vector indexes; L2/dot
use exact search when no compatible index exists.

FE, BE and C API checks bound query width to 128 subvectors and
candidate work to 100,000 for both `num_vectors * (top_k + offset)` and
`refine_factor * (top_k + offset)`. Actual null/non-finite stored
elements encountered by scoring fail execution; empty/null outer rows do
not rank. Undefined cosine pairs from zero-norm vectors are ignored, and
rows without a defined match for any query subvector are filtered. The
adapter resolves nested vector paths and backtick-quoted child names
consistently with Lance. The shared result-window code also preserves
Lance's strict batching stage after sorting and slicing; the older Doris
C binding does not expose a strict-batching setter, so that path is
covered by a native execution-plan test without adding an API. Requests
retain schema version 1; the optional `num_vectors` field distinguishes
matrices from ordinary single-vector payloads.

The vendored patch adds the matrix API without changing existing C
signatures. Following #67741, the third-party build now applies the
community patch chain on Lance-C 0.1.9, including the Lance v11 upgrade
and merged
[lance-format/lance-c#83](lance-format/lance-c#83).
PR #83's patch records its upstream commit and adapts overlapping
context to retain PR #79's scalar-segment execution path; its
multi-vector implementation and integration tests match upstream.
**Rebuild Lance-C: previously installed libraries lack the required
API.** Re-extract sources carrying the older patch chain; the build
rejects stale patch markers instead of silently retaining an old
library.

### Validation

Completed a full local self-review and corrected the issues found before
committing.

- 53 Lance BE reader tests passed with the reader/test sources and
generated Thrift linked to the newly patched Lance-C and existing BE
test dependencies. Segment-scoped TopK is compared with an independent
global scoring oracle across two index segments and an unindexed
fragment.
- The integrated Lance v11 patch chain passed 410 Rust tests, including
14 multi-vector integration tests. All three opt-in C/C++ compile/run
and static OSS transport tests also passed.
- 88 additional native query combinations passed independent score, ID,
window and full nested-payload checks against the same integrated
library.
- 31 focused FE tests and FE Checkstyle passed after retaining schema
version 1 and removing the multi-vector upgrade fence.
- clang-format 16, Groovy syntax compilation, standalone Groovy
scoring-oracle checks, fixture self-checks, shell syntax and zero-fuzz
patch application passed. The actual patch driver was checked for clean
application, repeat execution and rejection of stale source caches.
- Added SQL regression coverage with 768-row, 128-dimensional IVF_FLAT
and IVF_PQ fixtures: four partitions, two index segments and one
unindexed fragment. EXPLAIN assertions verify index/split planning;
independent expected results cover global TopK/offset, filtering, empty
windows, and full vector/nullable payload retrieval with lazy
materialization enabled and disabled.
- Expanded type/dimension/scoring coverage to Float16/Float32/Float64 at
dimensions 1, 3, 8 and 128, all three metrics, repeated query
subvectors, empty/null outer rows, unsupported schemas, invalid query
elements, Float16 overflow, and actual null/NaN/infinite stored elements
for every element type. Existing regressions retain nested-path,
precision, batch-size, default-metric and work-budget checks.

The complete `test_lance_multivector_coverage` and
`test_lance_vector_search_index_types` suites passed locally (2 suites,
0 failures, 0 skips) against the CI build of d38fba4. The
schema-version change was compiled and tested separately in the focused
FE/BE harnesses; those results are not a full Doris build of the final
revision. The complete external regression set remains for CI. Exact
equality in the representative index fixtures uses all partitions and
sufficient candidate overfetch; it is not a general ANN recall
guarantee.

### Release note

Support multi-vector Lance columns and query matrices in
`vector_search`, with documented row-level distance, filtering and TopK
semantics.

### Check List (For Author)

- Test
  - [x] Regression test added
  - [x] Unit Test
- Behavior changed
- [x] Multi-vector columns accept matrix queries; omitted metrics
consistently use L2.
- Documentation
  - [x] Added `docs/lance-multivector-search.md`.
- [x] Website documentation:
[apache/doris-website#4148](apache/doris-website#4148),
with English and Chinese usage examples, parameter defaults and limits,
scoring, null handling, and index/refinement guidance. Merge the
documentation with or after this PR.

### Check List (For Reviewer who merge this PR)

- [ ] Confirm the release note
- [ ] Confirm test cases
- [ ] Confirm document
- [ ] Add branch pick label

This branch was previously deployed

1 inactive deployment
Production — b89ac44d Deployed Sep 18, 2026 by Gabriel39 via Build Check #8376
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant