(
&self,
predicates: &Vec<MirScalarExpr>,
keys: &Vec<Vec<usize>>,
input: CardinalityEstimate,
)
| 1708 | } |
| 1709 | |
| 1710 | fn filter( |
| 1711 | &self, |
| 1712 | predicates: &Vec<MirScalarExpr>, |
| 1713 | keys: &Vec<Vec<usize>>, |
| 1714 | input: CardinalityEstimate, |
| 1715 | ) -> CardinalityEstimate { |
| 1716 | // TODO(mgree): should we try to do something for indices built on multiple columns? |
| 1717 | let mut unique_columns = BTreeSet::new(); |
| 1718 | for key in keys { |
| 1719 | if key.len() == 1 { |
| 1720 | unique_columns.insert(key[0]); |
| 1721 | } |
| 1722 | } |
| 1723 | |
| 1724 | let mut estimate = input; |
| 1725 | for expr in predicates { |
| 1726 | let selectivity = self.predicate(expr, &unique_columns); |
| 1727 | debug_assert!( |
| 1728 | OrderedFloat(0.0) <= selectivity && selectivity <= OrderedFloat(1.0), |
| 1729 | "predicate selectivity {selectivity} should be in the range [0,1]" |
| 1730 | ); |
| 1731 | estimate = estimate * selectivity.0; |
| 1732 | } |
| 1733 | |
| 1734 | estimate |
| 1735 | } |
| 1736 | |
| 1737 | fn join( |
| 1738 | &self, |
no test coverage detected