Gabriel39 opened a new pull request, #68815:
URL: https://github.com/apache/doris/pull/68815

   ### What problem does this PR solve?
   
   Issue Number: Closes #66493
   
   `vector_search()` cannot currently restrict results by distance. This adds 
optional `distance_lower_bound` (inclusive) and `distance_upper_bound` 
(exclusive) parameters for single-vector Radius/Range Search on Lance tables.
   
   The FE validates finite FLOAT bounds and their order, includes the range in 
EXPLAIN, and carries it through the external-search request. The BE applies the 
bounds through the existing pinned lance-c API after configuring the query 
vector, covering indexed and Flat Search splits, including appended data 
outside index coverage. Range requests use schema version 2 so older BEs reject 
them instead of silently ignoring the bounds; queries without bounds retain 
version 1.
   
   Results retain the existing table columns and FLOAT `_distance`, prefilter 
semantics, offset, and Top-K cap. ANN candidate recall and quantized distances 
remain approximate. Multi-vector distance bounds are rejected during both 
PREPARE and execution. Standalone BM25 is already delivered; the distributed 
BM25 statistics follow-up remains tracked separately in #67435.
   
   ### Release note
   
   Lance `vector_search()` supports optional lower and upper distance bounds 
for single-vector radius and range queries.
   
   ### Validation
   
   - BE: 60 `LanceTableReader*` tests passed under ASAN, including the new 
range tests and existing reader coverage.
   - FE: 21 tests passed in `VectorSearchTableValuedFunctionTest` and 
`LancePreparedSearchTest`.
   - Native execution: 10 cases passed against the pinned lance-c revision, 
covering indexed/Flat Search, appended unindexed data, inclusive/exclusive 
bounds, empty results, prefiltering, and offset.
   - FE Checkstyle and clang-format 16 checks passed.
   - Added SQL regression coverage for range results, projected stored columns, 
filtering, offset, invalid bounds, and EXPLAIN. Its Groovy syntax compilation 
passed; the SQL suite has not yet run against a live Doris cluster and requires 
External Regression CI.
   
   ### Check List (For Author)
   
   - Test
     - [x] Regression test added (execution pending CI)
     - [x] Unit Test
     - [x] Manual native execution test
   - Behavior changed:
     - [x] Yes: optional distance bounds on single-vector searches; existing 
unbounded queries retain their behavior.
   - Does this need documentation?
     - [x] Yes: bilingual 4.x Lance Catalog documentation: 
https://github.com/apache/doris-website/pull/4200.
   
   ### Check List (For Reviewer who merge this PR)
   
   - [ ] Confirm the release note
   - [ ] Confirm test cases
   - [ ] Confirm document
   - [ ] Add branch pick label
   


-- 
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]

Reply via email to