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>>,
)
| 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)`). |
| 122 | pub 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 | /// |
searching dependent graphs…