MCPcopy Create free account
hub / github.com/apache/datafusion / scan

Method scan

datafusion/catalog/src/memory/table.rs:227–262  ·  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

225 }
226
227 async fn scan(
228 &self,
229 state: &dyn Session,
230 projection: Option<&Vec<usize>>,
231 _filters: &[Expr],
232 _limit: Option<usize>,
233 ) -> Result<Arc<dyn ExecutionPlan>> {
234 let mut partitions = vec![];
235 for arc_inner_vec in self.batches.iter() {
236 let inner_vec = arc_inner_vec.read().await;
237 partitions.push(inner_vec.clone())
238 }
239
240 let mut source =
241 MemorySourceConfig::try_new(&partitions, self.schema(), projection.cloned())?;
242
243 let show_sizes = state.config_options().explain.show_sizes;
244 source = source.with_show_sizes(show_sizes);
245
246 // add sort information if present
247 let sort_order = self.sort_order.lock();
248 if !sort_order.is_empty() {
249 let df_schema = DFSchema::try_from(Arc::clone(&self.schema))?;
250
251 let eqp = state.execution_props();
252 let mut file_sort_order = vec![];
253 for sort_exprs in sort_order.iter() {
254 let physical_exprs =
255 create_physical_sort_exprs(sort_exprs, &df_schema, eqp)?;
256 file_sort_order.extend(LexOrdering::new(physical_exprs));
257 }
258 source = source.try_with_sort_information(file_sort_order)?;
259 }
260
261 Ok(DataSourceExec::from_data_source(source))
262 }
263
264 /// Returns an ExecutionPlan that inserts the execution results of a given [`ExecutionPlan`] into this [`MemTable`].
265 ///

Callers 1

loadMethod · 0.45

Calls 14

newFunction · 0.85
readMethod · 0.80
with_show_sizesMethod · 0.80
iterMethod · 0.45
pushMethod · 0.45
cloneMethod · 0.45
schemaMethod · 0.45
clonedMethod · 0.45
config_optionsMethod · 0.45
is_emptyMethod · 0.45
execution_propsMethod · 0.45

Tested by

no test coverage detected