Repository navigation
Conversation
Return row IDs and scores without fetching data columns. Intersect the requested interval with scalar filters before Top-K and validate the expected distance metric on indexed, raw and scheduled reads. Build local bitmaps only for partially covered index shards. Co-Authored-By: Codex <noreply@openai.com> AI-Model: gpt-6 AI-Contributed/Feature: 524/524 AI-Contributed/UT: 0/0
JingsongLi
left a comment
There was a problem hiding this comment.
Range-scoped scored search addresses the use case in #1521. I verified the generated C header and ran all 109 C binding tests. In the core vector suite, 600 tests passed, including a probe where the unrestricted Top-1 lies outside the requested interval. A separate worker-compatibility probe reproduced the metric failure below.
| field: String, | ||
| options: HashMap<String, String>, | ||
| #[serde(default)] | ||
| expected_distance_metric: Option<String>, |
There was a problem hiding this comment.
[P1] Enforce the expected metric when merging scheduled search results. The task keeps its existing kind and version, so an older worker can ignore this optional field and return L2 scores for a query that requires cosine. The coordinator already receives the persisted metric, but its check only uses the existing query options and the MultiVector default. With a fully indexed L2 table, dropping this field in a test executor produced a successful result with scores [1.0, 0.5]. Local execution rejected the same query. Compare the worker-reported metric with the expected metric before merging, or version the work so a worker that cannot enforce it rejects the task.
|
|
||
| pub(crate) fn ensure_distance_metric(&self, actual: &str) -> crate::Result<()> { | ||
| if let Some(expected) = &self.expected_distance_metric { | ||
| if expected != actual { |
There was a problem hiding this comment.
[P2] Use the same metric spelling rules for Rust callers on both search routes. with_expected_distance_metric("Inner-Product") goes through the PK metric parser and accepts this alias, while the Data Evolution route compares it verbatim and rejects the same persisted metric. Use the same parser on both routes.
|
|
||
| `paimon_vector_search_builder_execute_scored` returns global row IDs and scores | ||
| as Arrow Int64 and Float32 columns named `row_id` and `score`. An inclusive | ||
| interval supplied to `paimon_vector_search_builder_with_row_range` intersects |
There was a problem hiding this comment.
[P2] Document the scalar fallback for scored searches. Without a usable scalar index, the range restricts the ANN candidates first, then the predicate filters the candidate shortlist. A selective predicate can leave fewer than K hits even when more matching rows exist in-range, as the SQL guide already describes. Please also state that execute_scored requires global row IDs. It errors for primary-key results, whose positions are file-local.
Purpose
Closes #1521.
Let a consumer retrieve row IDs and scores directly for its assigned row range. Filtering after Top-K can lose valid candidates whenever the table-wide best matches fall outside that range.
Brief change log
row_idandscoreas Arrow Int64 and Float32. Propagate the expected metric to indexed, raw and scheduled searches and reject incompatible metrics.Tests
Added coverage for inclusive and invalid ranges, intersection with a scalar predicate, scored results, and distance-metric mismatches.
Local verification passed with
cargo build --locked -p paimon-c --libandcargo fmt --all -- --check. Test execution is left to upstream CI.API and Format
Adds C builder calls to set a row range and expected distance metric and to execute a scored search. Global row ranges apply to global row IDs. Primary-key results have file-local positions.
Documentation
The C binding guide describes scored output, interval bounds, prefiltering and distance metrics.