Bind stable vector handles during planning#19
Conversation
| @@ -261,6 +256,24 @@ struct SearchParams { | |||
| provider_scan: Option<Arc<dyn ExecutionPlan>>, | |||
| } | |||
There was a problem hiding this comment.
Now that registered is stored directly in SearchParams, the four fields schema, key_col, scalar_kind, and brute_force_threshold are redundant copies of registered.schema, registered.key_col, registered.scalar_kind, and registered.config.brute_force_selectivity_threshold. Since RegisteredTable is immutable after construction there's no correctness risk, but it doubles the storage for these values and means future readers have to wonder whether they might diverge.
Suggestion: remove the four flat fields and access them via params.registered.* at the call sites. The only call site that needs schema independently of registered is USearchExec::new (for PlanProperties) and RecordBatchStreamAdapter::new — both can use params.registered.schema.clone() directly.
There was a problem hiding this comment.
Addressed in 85a83a6 — removed the four redundant flat fields from SearchParams and access them via params.registered.* at all call sites.
Access schema, key_col, scalar_kind, and brute_force_threshold through params.registered.* instead of duplicating them as flat fields on SearchParams.
Summary
This changes the vector resolver contract from
ensure_loaded()toprepare(),and binds a stable
Arc<RegisteredTable>during planning.Why
Previously the planner and executor could re-resolve the registry entry in
separate steps, which left a handoff gap if the active vector index changed
mid-query.
With this change:
Changes
ensure_loaded()withprepare()prepare()returnArc<RegisteredTable>USearchExecPlannerto bind the prepared table during planningValidation
cargo test