pub trait AnalysisExpr {
// Provided methods
fn stat_falsification(
&self,
_catalog: &mut dyn StatsCatalog,
) -> Option<ExprRef> { ... }
fn max(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef> { ... }
fn min(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef> { ... }
fn nan_count(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef> { ... }
fn field_path(&self) -> Option<FieldPath> { ... }
}
Expand description
This can be used by expression to plug into vortex expression analysis, such as pruning or expression simplification
Provided Methods§
Sourcefn stat_falsification(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn stat_falsification(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression over zone-statistics which implies all records in the zone evaluate to false.
Given an expression, e
, if e.stat_falsification(..)
evaluates to true, it is guaranteed
that e
evaluates to false on all records in the zone. However, the inverse is not
necessarily true: even if the falsification evaluates to false, e
need not evaluate to
true on all records.
The StatsCatalog
can be used to constrain or rename stats used in the final expr.
§Examples
- An expression over one variable:
x > 0
is false for all records in a zone if the maximum value of the columnx
in that zone is less than or equal to zero:max(x) <= 0
. - An expression over two variables:
x > y
becomesmax(x) <= min(y)
. - A conjunctive expression:
x > y AND z < x
becomes `max(x) <= min(y) OR min(z) >= max(x).
Some expressions, in theory, have falsifications but this function does not support them
such as x < (y < z)
or x LIKE "needle%"
.
Sourcefn max(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn max(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression for the upper non-null bound of this expression, if available.
This function returns None if there is no upper bound or it is difficult to compute.
The returned expression evaluates to null if the maximum value is unknown. In that case, you must not assume the array is empty nor may you assume the array only contains non-null values.
Sourcefn min(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn min(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression for the lower non-null bound of this expression, if available.
See AnalysisExpr::max for important details.
Sourcefn nan_count(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
fn nan_count(&self, _catalog: &mut dyn StatsCatalog) -> Option<ExprRef>
An expression for the NaN count for a column, if available.
This method returns None
if the NaNCount stat is unknown.