(
files: &[TestFile],
predicate: Arc<dyn PhysicalExpr>,
prune_stats: bool,
schema: Arc<Schema>,
ctx: &SessionContext,
)
| 271 | } |
| 272 | |
| 273 | async 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 | |
| 317 | async fn write_parquet_file( |
| 318 | truncation_length: Option<usize>, |
no test coverage detected
searching dependent graphs…