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

Function build_pruning_predicate

datafusion/pruning/src/pruning_predicate.rs:385–402  ·  view source on GitHub ↗

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,
)

Source from the content-addressed store, hash-verified

383/// If there is an error creating the pruning predicate it is recorded by incrementing
384/// the `predicate_creation_errors` counter.
385pub 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

Callers 2

build_pruning_predicatesFunction · 0.85
should_pruneMethod · 0.85

Calls 3

newFunction · 0.85
always_trueMethod · 0.80
addMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…