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

Function conjunction_opt

datafusion/physical-expr/src/utils/mod.rs:122–131  ·  view source on GitHub ↗

Create a conjunction of the given predicates. If the input is empty or the return None. If the input contains a single predicate, return Some(predicate). Otherwise, return a Some(..) of a conjunction of the predicates (e.g. `Some(a AND b AND c)`).

(
    predicates: impl IntoIterator<Item = Arc<dyn PhysicalExpr>>,
)

Source from the content-addressed store, hash-verified

120/// If the input contains a single predicate, return Some(predicate).
121/// Otherwise, return a Some(..) of a conjunction of the predicates (e.g. `Some(a AND b AND c)`).
122pub fn conjunction_opt(
123 predicates: impl IntoIterator<Item = Arc<dyn PhysicalExpr>>,
124) -> Option<Arc<dyn PhysicalExpr>> {
125 predicates
126 .into_iter()
127 .fold(None, |acc, predicate| match acc {
128 None => Some(predicate),
129 Some(acc) => Some(Arc::new(BinaryExpr::new(acc, Operator::And, predicate))),
130 })
131}
132
133/// Assume the predicate is in the form of DNF, split the predicate to a Vec of PhysicalExprs.
134///

Callers 2

conjunctionFunction · 0.85
try_pushdown_filtersMethod · 0.85

Calls 2

newFunction · 0.85
into_iterMethod · 0.45

Tested by 1

try_pushdown_filtersMethod · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…