[core] Support batch vector search - #7857
Conversation
JingsongLi
left a comment
There was a problem hiding this comment.
This batch query is not meaningful for performance, we need to ensure that the local file cache is enabled. See ce38b2c
Do you mean we should add a validation for |
1e339c3 to
6f73663
Compare
|
@JingsongLi Sorry, I accidentally deleted your comment while trying to reply. I want to confirm if I understood your point correctly. Batch query vectors share one scan and one reader/native index loading per split within one invocation. Do you mean that local file cache for meta/global-index files is sufficient for repeated single-vector queries, so the reader/native-index reuse provided by this batch API is not necessary? |
|
Also, how is the return value handled? How do users know which input corresponds to which one? |
973c670 to
a417c1a
Compare
Results keep the same order as input vectors — results.get(i) corresponds to queryVectors[i] |
2dc3a71 to
93b02e6
Compare
I ran an OSS benchmark with a 529MB Lumina index, 100 queries, dim=1024. So without cache, batch is effective. With warm cache, the benefit is very small, which matches your Since users need a batch API, for the Spark/Flink batch API, which direction do you prefer?
|
8285af1 to
424f109
Compare
|
@JingsongLi @yunfengzhou-hub Could you help take a look again when you are free |
JingsongLi
left a comment
There was a problem hiding this comment.
My suggestion is that the API design should not be mixed with previous single search, and there should also be a corresponding BatchVectorSearchBuilder.
|
And we should also support Python api. |
223dbd3 to
a15f65a
Compare
Add batch vector search: one call searches multiple query vectors against a vector column, with result i corresponding to query vector i. - New BatchVectorSearch predicate and GlobalIndexReader.visitBatchVectorSearch with a concurrent per-vector fan-out default for indexes without a native batch path. - Lumina and paimon-vector-index (IVF) readers override it to run all vectors in a single native call; single-vector batches short-circuit to the scalar path. Shared filter/offset/scoring logic is factored out (VectorSearchUtils, resolveScope/SearchScope, buildScoredResult). - Dedicated BatchVectorSearchBuilder (Java) / BatchVectorSearchBuilder (pypaimon), kept separate from the single-vector builder, exposed via Table.newBatchVectorSearchBuilder(). The new Table method is a default (Java) / non-abstract (Python) so the @public interface stays compatible for external implementations; options are defensively copied and inputs validated up front. - Tests across core, Lumina, paimon-vector-index and pypaimon, plus docs.
a15f65a to
f26bdf7
Compare
|
+1 |
Purpose
Tests