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

Method scan

datafusion/core/src/dataframe/mod.rs:2670–2694  ·  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

2668 }
2669
2670 async fn scan(
2671 &self,
2672 state: &dyn Session,
2673 projection: Option<&Vec<usize>>,
2674 filters: &[Expr],
2675 limit: Option<usize>,
2676 ) -> Result<Arc<dyn ExecutionPlan>> {
2677 let mut expr = LogicalPlanBuilder::from(self.plan.clone());
2678 // Add filter when given
2679 let filter = filters.iter().cloned().reduce(|acc, new| acc.and(new));
2680 if let Some(filter) = filter {
2681 expr = expr.filter(filter)?
2682 }
2683
2684 if let Some(p) = projection {
2685 expr = expr.select(p.iter().copied())?
2686 }
2687
2688 // add a limit if given
2689 if let Some(l) = limit {
2690 expr = expr.limit(0, Some(l))?
2691 }
2692 let plan = expr.build()?;
2693 state.create_physical_plan(&plan).await
2694 }
2695}
2696
2697// see tests in datafusion/core/tests/dataframe/mod.rs:2816

Callers 8

test_with_projectionFunction · 0.45
test_without_projectionFunction · 0.45
test_invalid_projectionFunction · 0.45
test_merged_schemaFunction · 0.45
read_single_fileFunction · 0.45
read_empty_tableFunction · 0.45
test_basic_table_scanFunction · 0.45

Calls 9

cloneMethod · 0.45
clonedMethod · 0.45
iterMethod · 0.45
andMethod · 0.45
filterMethod · 0.45
selectMethod · 0.45
limitMethod · 0.45
buildMethod · 0.45
create_physical_planMethod · 0.45

Tested by 6

test_with_projectionFunction · 0.36
test_without_projectionFunction · 0.36
test_invalid_projectionFunction · 0.36
test_merged_schemaFunction · 0.36
test_basic_table_scanFunction · 0.36