Trait mz_transform::attribute::cardinality::Factorizer
source · pub trait Factorizer {
// Required methods
fn flat_map(&self, tf: &TableFunc, input: &SymExp) -> SymExp;
fn predicate(
&self,
expr: &MirScalarExpr,
unique_columns: &BTreeSet<usize>
) -> SymExp;
fn filter(
&self,
predicates: &Vec<MirScalarExpr>,
keys: &Vec<Vec<usize>>,
input: &SymExp
) -> SymExp;
fn join(
&self,
equivalences: &Vec<Vec<MirScalarExpr>>,
implementation: &JoinImplementation,
unique_columns: BTreeMap<usize, usize>,
inputs: Vec<&SymExp>
) -> SymExp;
fn reduce(
&self,
group_key: &Vec<MirScalarExpr>,
expected_group_size: &Option<u64>,
input: &SymExp
) -> SymExp;
fn topk(
&self,
group_key: &Vec<usize>,
limit: &Option<MirScalarExpr>,
expected_group_size: &Option<u64>,
input: &SymExp
) -> SymExp;
fn threshold(&self, input: &SymExp) -> SymExp;
}
Expand description
A Factorizer
computes selectivity factors
Required Methods§
sourcefn flat_map(&self, tf: &TableFunc, input: &SymExp) -> SymExp
fn flat_map(&self, tf: &TableFunc, input: &SymExp) -> SymExp
Compute selectivity for the flat map of tf
sourcefn predicate(
&self,
expr: &MirScalarExpr,
unique_columns: &BTreeSet<usize>
) -> SymExp
fn predicate( &self, expr: &MirScalarExpr, unique_columns: &BTreeSet<usize> ) -> SymExp
Computes selectivity of the predicate expr
, given that unique_columns
are indexed/unique
The result should be in the range [0, 1.0]
sourcefn filter(
&self,
predicates: &Vec<MirScalarExpr>,
keys: &Vec<Vec<usize>>,
input: &SymExp
) -> SymExp
fn filter( &self, predicates: &Vec<MirScalarExpr>, keys: &Vec<Vec<usize>>, input: &SymExp ) -> SymExp
Computes selectivity for a filter
sourcefn join(
&self,
equivalences: &Vec<Vec<MirScalarExpr>>,
implementation: &JoinImplementation,
unique_columns: BTreeMap<usize, usize>,
inputs: Vec<&SymExp>
) -> SymExp
fn join( &self, equivalences: &Vec<Vec<MirScalarExpr>>, implementation: &JoinImplementation, unique_columns: BTreeMap<usize, usize>, inputs: Vec<&SymExp> ) -> SymExp
Computes selectivity for a join; the cardinality estimate for each input is paired with the keys on that input
unique_columns
maps column references (that are indexed/unique) to their relation’s index in inputs
sourcefn reduce(
&self,
group_key: &Vec<MirScalarExpr>,
expected_group_size: &Option<u64>,
input: &SymExp
) -> SymExp
fn reduce( &self, group_key: &Vec<MirScalarExpr>, expected_group_size: &Option<u64>, input: &SymExp ) -> SymExp
Computes selectivity for a reduce