Struct mz_transform::predicate_pushdown::PredicatePushdown
source · [−]pub struct PredicatePushdown {
recursion_guard: RecursionGuard,
}
Expand description
Pushes predicates down through other operators.
Fields
recursion_guard: RecursionGuard
Implementations
sourceimpl PredicatePushdown
impl PredicatePushdown
sourcepub 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.
sourcepub fn push_filters_through_map(
&self,
scalars: &Vec<MirScalarExpr>,
predicates: &mut Vec<MirScalarExpr>,
input_arity: usize,
all_errors: bool
) -> Result<(Vec<MirScalarExpr>, Vec<MirScalarExpr>), TransformError>
pub fn push_filters_through_map(
&self,
scalars: &Vec<MirScalarExpr>,
predicates: &mut Vec<MirScalarExpr>,
input_arity: usize,
all_errors: bool
) -> Result<(Vec<MirScalarExpr>, Vec<MirScalarExpr>), TransformError>
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.
sourcepub 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.
sourcefn 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_equal_or_both_null_inner(
or_arg1: &MirScalarExpr,
or_arg2: &MirScalarExpr,
relation_type: &RelationType
) -> Option<(MirScalarExpr, MirScalarExpr)>
sourcefn extract_reduced_conjunction_terms(
s: MirScalarExpr,
relation_type: &RelationType
) -> Vec<MirScalarExpr>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
fn extract_reduced_conjunction_terms(
s: MirScalarExpr,
relation_type: &RelationType
) -> Vec<MirScalarExpr>ⓘNotable traits for Vec<u8, A>impl<A> Write for Vec<u8, A> where
A: Allocator,
A: Allocator,
Reduces the given expression and returns its AND-ed terms.
sourcefn can_inline(s: &MirScalarExpr, input_arity: usize) -> bool
fn can_inline(s: &MirScalarExpr, input_arity: usize) -> bool
Defines a criteria for inlining scalar expressions.
fn is_safe_leaf(s: &MirScalarExpr, input_arity: usize) -> bool
Trait Implementations
sourceimpl CheckedRecursion for PredicatePushdown
impl CheckedRecursion for PredicatePushdown
sourcefn recursion_guard(&self) -> &RecursionGuard
fn recursion_guard(&self) -> &RecursionGuard
Extracts a reference to the recursion guard embedded within the type.
sourcefn 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
sourcefn 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
sourceimpl Debug for PredicatePushdown
impl Debug for PredicatePushdown
sourceimpl Default for PredicatePushdown
impl Default for PredicatePushdown
sourcefn default() -> PredicatePushdown
fn default() -> PredicatePushdown
Returns the “default value” for a type. Read more
sourceimpl Transform for PredicatePushdown
impl Transform for PredicatePushdown
sourcefn 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
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> FutureExt for T
impl<T> FutureExt for T
sourcefn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
sourcefn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
sourcefn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
Wrap the input message T
in a tonic::Request
sourceimpl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<P, R> ProtoType<R> for P where
R: RustType<P>,
impl<P, R> ProtoType<R> for P where
R: RustType<P>,
sourcefn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
See RustType::from_proto
.
sourcefn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
See RustType::into_proto
.
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more