Repository navigation
feat(rust)!: expose vector query partition parallelism - #5054
Conversation
Xuanwo
left a comment
There was a problem hiding this comment.
query_parallelism(1) works per index segment on an ordinary Embedded IVF query. Adding a second query vector can select ANNIvfBatchExec, which accepts the setting but still sizes its load and scoring windows from the CPU pool. Please either honor the setting there or return NotSupported when it is explicitly supplied on that plan. Batch scheduler
For Enterprise, I verified that the SDK sends the field over loopback HTTP. The server request model I inspected does not consume it. Please gate explicit settings on backend support and return NotSupported where the requested scheduling cannot be provided. Test explicit versus unset for both paths, and document the per-segment scope. When rebasing the namespace routing predicate, please retain main’s ordering and scan-order checks.
6652cd1 to
1d8ec79
Compare
There was a problem hiding this comment.
✅ Gate recommendation: approve.
The revision addresses the batch IVF and Enterprise concerns by rejecting explicit settings where scheduling cannot be honored. Ordinary Embedded IVF applies the option per index segment, while unset requests preserve existing scheduling. Result-equivalence and backend-rejection tests pass, and namespace ordering and RTE guards remain intact.
Please mark this PR with the breaking-change label: lancedb::query::VectorQueryRequest adds query_parallelism, so Rust callers using exhaustive struct literals must initialize the new field.
At 1d8ec79, the planner rejects explicit query_parallelism on shared batch IVF and Enterprise. The default routes and namespace ordering checks are preserved. I verified these changes in source.
Xuanwo
left a comment
There was a problem hiding this comment.
Please use feat(rust)!: in the PR title and start the description with the migration note below. This gives Rust callers a direct fix for the missing-field compiler error when upgrading from v0.41.0.
BREAKING CHANGE: Callers that initialize
VectorQueryRequestwith an exhaustive struct literal must addquery_parallelism: Noneto preserve automatic scheduling.
The title now marks the breaking change and the description explains how exhaustive VectorQueryRequest literals can preserve automatic scheduling.
BREAKING CHANGE: Callers that initialize
VectorQueryRequestwith an exhaustive struct literal must addquery_parallelism: Noneto preserve automatic scheduling.Expose Lance's existing IVF partition-search concurrency control through the Rust
VectorQuery::query_parallelismbuilder. This lets callers override the automatic sequential policy used by flat sub-indexes without changing the probe budget or bypassing LanceDB's query API.The setting is optional, so existing queries keep their behavior. Accepted values match Lance:
0for automatic selection,-1for the CPU pool,1for sequential execution, and positive limits for partition-parallel execution. Values below-1are rejected, including requests constructed directly through public fields.An ordinary Embedded IVF query applies the setting within each index segment. Separate segments may run concurrently. If the selected plan uses shared batch IVF, an explicit value returns
NotSupportedbecause its scheduler controls its own load and scoring windows. Leaving it unset preserves batch execution. Enterprise also returnsNotSupportedbefore sending an explicitly configured query because its request contract does not support this setting. Namespace queries with explicit settings route locally. The existing ordering, scan-order and RTE checks remain in effect.The tests cover single-segment IVF values and result equivalence, two-vector Embedded batch execution with the option unset and rejected explicit settings, Enterprise default requests and rejection before HTTP for explicit settings, direct invalid requests, and namespace/RTE routing. The Rust API and vector-search guide document the per-segment scope.
Lance already exposes this control (introduced in lance-format/lance#6475); this PR exposes it at the LanceDB Rust layer.