Build a pruning predicate from an optional predicate expression. If the predicate is None or the predicate cannot be converted to a pruning predicate, return None. If there is an error creating the pruning predicate it is recorded by incrementing the `predicate_creation_errors` counter.
(
predicate: Arc<dyn PhysicalExpr>,
file_schema: &SchemaRef,
predicate_creation_errors: &Count,
)
| 383 | /// If there is an error creating the pruning predicate it is recorded by incrementing |
| 384 | /// the `predicate_creation_errors` counter. |
| 385 | pub fn build_pruning_predicate( |
| 386 | predicate: Arc<dyn PhysicalExpr>, |
| 387 | file_schema: &SchemaRef, |
| 388 | predicate_creation_errors: &Count, |
| 389 | ) -> Option<Arc<PruningPredicate>> { |
| 390 | match PruningPredicate::try_new(predicate, Arc::clone(file_schema)) { |
| 391 | Ok(pruning_predicate) => { |
| 392 | if !pruning_predicate.always_true() { |
| 393 | return Some(Arc::new(pruning_predicate)); |
| 394 | } |
| 395 | } |
| 396 | Err(e) => { |
| 397 | debug!("Could not create pruning predicate for: {e}"); |
| 398 | predicate_creation_errors.add(1); |
| 399 | } |
| 400 | } |
| 401 | None |
| 402 | } |
| 403 | |
| 404 | /// Rewrites predicates that [`PredicateRewriter`] can not handle, e.g. certain |
| 405 | /// complex expressions or predicates that reference columns that are not in the |
no test coverage detected
searching dependent graphs…