MCPcopy Create free account
hub / github.com/apache/paimon-rust / scan

Method scan

crates/integrations/datafusion/src/vector_search.rs:153–198  ·  view source on GitHub ↗
(
        &self,
        state: &dyn Session,
        projection: Option<&Vec<usize>>,
        _filters: &[Expr],
        limit: Option<usize>,
    )

Source from the content-addressed store, hash-verified

151 }
152
153 async fn scan(
154 &self,
155 state: &dyn Session,
156 projection: Option<&Vec<usize>>,
157 _filters: &[Expr],
158 limit: Option<usize>,
159 ) -> DFResult<Arc<dyn ExecutionPlan>> {
160 let table = self.inner.table();
161
162 let row_ranges = await_with_runtime(async {
163 let mut builder = table.new_vector_search_builder();
164 builder
165 .with_vector_column(&self.column_name)
166 .with_query_vector(self.query_vector.clone())
167 .with_limit(self.limit);
168 builder.execute().await.map_err(to_datafusion_error)
169 })
170 .await?;
171
172 if row_ranges.is_empty() {
173 let schema = project_schema(&self.schema(), projection)?;
174 return Ok(Arc::new(EmptyExec::new(schema)));
175 }
176
177 let mut read_builder = table.new_read_builder();
178 if let Some(limit) = limit {
179 read_builder.with_limit(limit);
180 }
181 let scan = read_builder.new_scan().with_row_ranges(row_ranges);
182 let plan = await_with_runtime(scan.plan())
183 .await
184 .map_err(to_datafusion_error)?;
185
186 let target = state.config_options().execution.target_partitions;
187 PaimonScanBuilder {
188 table,
189 schema: &self.schema(),
190 plan: &plan,
191 projection,
192 pushed_predicate: None,
193 limit,
194 target_partitions: target,
195 filter_exact: false,
196 }
197 .build()
198 }
199
200 fn supports_filters_pushdown(
201 &self,

Callers

nothing calls this directly

Calls 14

await_with_runtimeFunction · 0.85
with_query_vectorMethod · 0.80
with_vector_columnMethod · 0.80
new_read_builderMethod · 0.80
new_scanMethod · 0.80
planMethod · 0.80
tableMethod · 0.45
with_limitMethod · 0.45
executeMethod · 0.45
is_emptyMethod · 0.45
schemaMethod · 0.45

Tested by

no test coverage detected