Struct transform::predicate_pushdown::PredicatePushdown [−][src]
pub struct PredicatePushdown {
recursion_guard: RecursionGuard,
}
Expand description
Pushes predicates down through other operators.
Fields
recursion_guard: RecursionGuard
Implementations
pub fn action(
&self,
relation: &mut MirRelationExpr,
get_predicates: &mut HashMap<Id, HashSet<MirScalarExpr>>
) -> Result<(), TransformError>
pub fn action(
&self,
relation: &mut MirRelationExpr,
get_predicates: &mut HashMap<Id, HashSet<MirScalarExpr>>
) -> Result<(), TransformError>
Predicate pushdown
This method looks for opportunities to push predicates toward
sources of data. Primarily, this is the Filter
expression,
and moving its predicates through the operators it contains.
In addition, the method accumulates the intersection of predicates
applied to each Get
expression, so that the predicate can
then be pushed through to a Let
binding, or to the external
source of the data if the Get
binds to another view.
pub fn push_filters_through_map(
&self,
scalars: &Vec<MirScalarExpr>,
predicates: &mut Vec<MirScalarExpr>,
input_arity: usize,
all_errors: bool
) -> (Vec<MirScalarExpr>, Vec<MirScalarExpr>)
pub fn push_filters_through_map(
&self,
scalars: &Vec<MirScalarExpr>,
predicates: &mut Vec<MirScalarExpr>,
input_arity: usize,
all_errors: bool
) -> (Vec<MirScalarExpr>, Vec<MirScalarExpr>)
Computes “safe” predicates to push through a Map.
In the case of a Filter { Map {…} }, we can always push down the Filter by inlining expressions from the Map. We don’t want to do this in general, however, since general inlining can result in exponential blowup in the size of expressions, so we only do this in the case where we deem the referenced expressions “safe.” See the comment above can_inline for more details. Note that this means we can always push down filters that only reference input columns.
Returns the predicates that can be pushed down, followed by ones that cannot.
pub fn push_filters_through_flat_map(
predicates: &mut Vec<MirScalarExpr>,
input_arity: usize
) -> (Vec<MirScalarExpr>, Vec<MirScalarExpr>)
pub fn push_filters_through_flat_map(
predicates: &mut Vec<MirScalarExpr>,
input_arity: usize
) -> (Vec<MirScalarExpr>, Vec<MirScalarExpr>)
Computes “safe” predicate to push through a FlatMap.
In the case of a Filter { FlatMap {…} }, we want to push through all predicates that (1) are not literal errors and (2) have support exclusively in the columns provided by the FlatMap input.
Returns the predicates that can be pushed down, followed by ones that cannot.
fn extract_equal_or_both_null(
s: &mut MirScalarExpr,
relation_type: &RelationType
) -> Option<(MirScalarExpr, MirScalarExpr)>
fn extract_equal_or_both_null(
s: &mut MirScalarExpr,
relation_type: &RelationType
) -> Option<(MirScalarExpr, MirScalarExpr)>
If s
is of the form
(isnull(expr1) && isnull(expr2)) || (expr1 = expr2)
, or
(decompose_is_null(expr1) && decompose_is_null(expr2)) || (expr1 = expr2)
,
extract expr1
and expr2
.
fn extract_reduced_conjunction_terms(
s: MirScalarExpr,
relation_type: &RelationType
) -> Vec<MirScalarExpr>ⓘ
fn extract_reduced_conjunction_terms(
s: MirScalarExpr,
relation_type: &RelationType
) -> Vec<MirScalarExpr>ⓘ
Reduces the given expression and returns its AND-ed terms.
Defines a criteria for inlining scalar expressions.
Trait Implementations
Extracts a reference to the recursion guard embedded within the type.
fn checked_recur<F, T, E>(&self, f: F) -> Result<T, E> where
F: FnOnce(&Self) -> Result<T, E>,
E: From<RecursionLimitError>,
fn checked_recur<F, T, E>(&self, f: F) -> Result<T, E> where
F: FnOnce(&Self) -> Result<T, E>,
E: From<RecursionLimitError>,
Checks whether it is safe to recur and calls f
if so. Read more
fn checked_recur_mut<F, T, E>(&mut self, f: F) -> Result<T, E> where
F: FnOnce(&mut Self) -> Result<T, E>,
E: From<RecursionLimitError>,
fn checked_recur_mut<F, T, E>(&mut self, f: F) -> Result<T, E> where
F: FnOnce(&mut Self) -> Result<T, E>,
E: From<RecursionLimitError>,
Like CheckedRecursion::checked_recur
, but operates on a mutable
reference to Self
. Read more
Returns the “default value” for a type. Read more
fn transform(
&self,
relation: &mut MirRelationExpr,
_: TransformArgs<'_>
) -> Result<(), TransformError>
fn transform(
&self,
relation: &mut MirRelationExpr,
_: TransformArgs<'_>
) -> Result<(), TransformError>
Transform a relation into a functionally equivalent relation.
Auto Trait Implementations
impl !RefUnwindSafe for PredicatePushdown
impl Send for PredicatePushdown
impl !Sync for PredicatePushdown
impl Unpin for PredicatePushdown
impl UnwindSafe for PredicatePushdown
Blanket Implementations
Mutably borrows from an owned value. Read more
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more