MCPcopy Create free account
hub / github.com/MaterializeInc/materialize / filter

Method filter

src/transform/src/analysis.rs:1710–1735  ·  view source on GitHub ↗
(
            &self,
            predicates: &Vec<MirScalarExpr>,
            keys: &Vec<Vec<usize>>,
            input: CardinalityEstimate,
        )

Source from the content-addressed store, hash-verified

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,

Callers 15

forgetMethod · 0.45
assert_eqMethod · 0.45
filter_retractionsMethod · 0.45
fetch_partsMethod · 0.45
reclockFunction · 0.45
merge_withMethod · 0.45
parse_explain_sqlFunction · 0.45
reset_schema_registryMethod · 0.45
run_verify_keysFunction · 0.45
run_verify_dataFunction · 0.45
rebuild_mfpMethod · 0.45

Calls 3

predicateMethod · 0.80
lenMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected