File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -100,6 +100,7 @@ use datafusion::prelude::SessionContext;
100100/// - `cosine_distance(col, query)` — cosine distance
101101/// - `negative_dot_product(col, query)` — negated inner product
102102/// - `vector_usearch(table, query, k)` — explicit ANN table function
103+ /// (cache-only for async-backed resolvers; does not trigger async loads)
103104/// - [`USearchRule`] — optimizer rewrite rule
104105///
105106/// The [`USearchQueryPlanner`] must be installed at `SessionState` build time
@@ -110,6 +111,8 @@ pub fn register_all(ctx: &SessionContext, registry: Arc<dyn VectorIndexResolver>
110111 ctx. register_udf ( ScalarUDF :: new_from_impl ( negative_dot_product_udf ( ) ) ) ;
111112 ctx. register_udtf (
112113 "vector_usearch" ,
114+ // `vector_usearch()` is synchronous and therefore cache-only for
115+ // async-backed resolvers.
113116 Arc :: new ( USearchUDTF :: new ( registry. clone ( ) ) ) ,
114117 ) ;
115118 ctx. add_optimizer_rule ( Arc :: new ( USearchRule :: new ( registry) ) ) ;
Original file line number Diff line number Diff line change @@ -41,6 +41,11 @@ use crate::registry::VectorIndexResolver;
4141///
4242/// Returns `(key: UInt64, _distance: Float32)`. Join with your data table on
4343/// the key column to retrieve full rows.
44+ ///
45+ /// This entry point is synchronous. For async-backed [`VectorIndexResolver`]
46+ /// implementations, it only works when the target index is already loaded in
47+ /// the local cache. `vector_usearch()` does not call `ensure_loaded()` and
48+ /// cannot trigger async index loads.
4449pub struct USearchUDTF {
4550 registry : Arc < dyn VectorIndexResolver > ,
4651}
@@ -87,7 +92,9 @@ impl TableFunctionImpl for USearchUDTF {
8792
8893 let registered = self . registry . resolve ( & table_name) . ok_or_else ( || {
8994 DataFusionError :: Execution ( format ! (
90- "vector_usearch: table '{table_name}' not registered"
95+ "vector_usearch: table '{table_name}' is not loaded locally. \
96+ This synchronous path only checks the local cache and cannot trigger async \
97+ loads. Use the optimizer/planner vector query path or pre-load the index first."
9198 ) )
9299 } ) ?;
93100
You can’t perform that action at this time.
0 commit comments