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

Function execute_with_predicate

datafusion/core/tests/fuzz_cases/pruning.rs:273–315  ·  view source on GitHub ↗
(
    files: &[TestFile],
    predicate: Arc<dyn PhysicalExpr>,
    prune_stats: bool,
    schema: Arc<Schema>,
    ctx: &SessionContext,
)

Source from the content-addressed store, hash-verified

271}
272
273async fn execute_with_predicate(
274 files: &[TestFile],
275 predicate: Arc<dyn PhysicalExpr>,
276 prune_stats: bool,
277 schema: Arc<Schema>,
278 ctx: &SessionContext,
279) -> Vec<String> {
280 let parquet_source = if prune_stats {
281 ParquetSource::new(schema.clone()).with_predicate(predicate.clone())
282 } else {
283 ParquetSource::new(schema.clone())
284 };
285 let config = FileScanConfigBuilder::new(
286 ObjectStoreUrl::parse("memory://").unwrap(),
287 Arc::new(parquet_source),
288 )
289 .with_file_group(
290 files
291 .iter()
292 .map(|test_file| {
293 PartitionedFile::new(test_file.path.clone(), test_file.size as u64)
294 })
295 .collect(),
296 )
297 .build();
298 let exec = DataSourceExec::from_data_source(config);
299 let exec =
300 Arc::new(FilterExec::try_new(predicate, exec).unwrap()) as Arc<dyn ExecutionPlan>;
301
302 let batches = collect(exec, ctx.task_ctx()).await.unwrap();
303 let mut values = vec![];
304 for batch in batches {
305 let column = batch
306 .column(0)
307 .as_any()
308 .downcast_ref::<StringArray>()
309 .unwrap();
310 for i in 0..column.len() {
311 values.push(column.value(i).to_string());
312 }
313 }
314 values
315}
316
317async fn write_parquet_file(
318 truncation_length: Option<usize>,

Callers 1

runMethod · 0.85

Calls 15

newFunction · 0.85
with_file_groupMethod · 0.80
collectMethod · 0.80
columnMethod · 0.80
collectFunction · 0.50
with_predicateMethod · 0.45
cloneMethod · 0.45
buildMethod · 0.45
mapMethod · 0.45
iterMethod · 0.45
task_ctxMethod · 0.45
as_anyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…