pub struct MfpPlan {
pub(crate) mfp: SafeMfpPlan,
pub(crate) lower_bounds: Vec<MirScalarExpr>,
pub(crate) upper_bounds: Vec<MirScalarExpr>,
}
Expand description
Predicates partitioned into temporal and non-temporal.
Temporal predicates require some recognition to determine their structure, and it is best to do that once and re-use the results.
There are restrictions on the temporal predicates we currently support.
They must directly constrain MzNow
from below or above,
by expressions that do not themselves contain MzNow
.
Conjunctions of such constraints are also ok.
Fields§
§mfp: SafeMfpPlan
Normal predicates to evaluate on &[Datum]
and expect Ok(Datum::True)
.
lower_bounds: Vec<MirScalarExpr>
Expressions that when evaluated lower-bound MzNow
.
upper_bounds: Vec<MirScalarExpr>
Expressions that when evaluated upper-bound MzNow
.
Implementations§
source§impl MfpPlan
impl MfpPlan
sourcepub fn create_from(mfp: MapFilterProject) -> Result<Self, String>
pub fn create_from(mfp: MapFilterProject) -> Result<Self, String>
Partitions predicates
into non-temporal, and lower and upper temporal bounds.
The first returned list is of predicates that do not contain mz_now
.
The second and third returned lists contain expressions that, once evaluated, lower
and upper bound the validity interval of a record, respectively. These second two
lists are populated only by binary expressions of the form
mz_now cmp_op expr
where cmp_op
is a comparison operator and expr
does not contain mz_now
.
If any unsupported expression is found, for example one that uses mz_now
in an unsupported position, an error is returned.
sourcepub fn is_identity(&self) -> bool
pub fn is_identity(&self) -> bool
Indicates if the planned MapFilterProject
emits exactly its inputs as outputs.
sourcepub fn take(&mut self) -> Self
pub fn take(&mut self) -> Self
Returns self
, and leaves behind an identity operator that acts on its output.
sourcepub fn into_nontemporal(self) -> Result<SafeMfpPlan, Self>
pub fn into_nontemporal(self) -> Result<SafeMfpPlan, Self>
Attempt to convert self into a non-temporal MapFilterProject plan.
If that is not possible, the original instance is returned as an error.
sourcepub fn iter_nontemporal_exprs(
&mut self,
) -> impl Iterator<Item = &mut MirScalarExpr>
pub fn iter_nontemporal_exprs( &mut self, ) -> impl Iterator<Item = &mut MirScalarExpr>
Returns an iterator over mutable references to all non-temporal scalar expressions in the plan.
The order of iteration is unspecified.
sourcepub fn evaluate<'b, 'a: 'b, E: From<EvalError>, V: Fn(&Timestamp) -> bool>(
&'a self,
datums: &'b mut Vec<Datum<'a>>,
arena: &'a RowArena,
time: Timestamp,
diff: Diff,
valid_time: V,
row_builder: &mut Row,
) -> impl Iterator<Item = Result<(Row, Timestamp, Diff), (E, Timestamp, Diff)>>
pub fn evaluate<'b, 'a: 'b, E: From<EvalError>, V: Fn(&Timestamp) -> bool>( &'a self, datums: &'b mut Vec<Datum<'a>>, arena: &'a RowArena, time: Timestamp, diff: Diff, valid_time: V, row_builder: &mut Row, ) -> impl Iterator<Item = Result<(Row, Timestamp, Diff), (E, Timestamp, Diff)>>
Evaluate the predicates, temporal and non-, and return times and differences for data
.
If self
contains only non-temporal predicates, the result will either be (time, diff)
,
or an evaluation error. If self contains temporal predicates, the results can be times that are greater than the input
time, and may contain negated
diff` values.
The row_builder
is not cleared first, but emptied if the function
returns an iterator with any Ok(_)
element.
sourcepub fn could_error(&self) -> bool
pub fn could_error(&self) -> bool
Returns true if evaluation could introduce an error on non-error inputs.
sourcepub fn ignores_input(&self) -> bool
pub fn ignores_input(&self) -> bool
Indicates that Self
ignores its input to the extent that it can be evaluated on &[]
.
At the moment, this is only true if it projects away all columns and applies no filters, but it could be extended to plans that produce literals independent of the input.
Trait Implementations§
source§impl Arbitrary for MfpPlan
impl Arbitrary for MfpPlan
§type Parameters = <SafeMfpPlan as Arbitrary>::Parameters
type Parameters = <SafeMfpPlan as Arbitrary>::Parameters
arbitrary_with
accepts for configuration
of the generated Strategy
. Parameters must implement Default
.§type Strategy = Map<(<SafeMfpPlan as Arbitrary>::Strategy, BoxedStrategy<Vec<MirScalarExpr>>, BoxedStrategy<Vec<MirScalarExpr>>), fn(_: (SafeMfpPlan, Vec<MirScalarExpr>, Vec<MirScalarExpr>)) -> MfpPlan>
type Strategy = Map<(<SafeMfpPlan as Arbitrary>::Strategy, BoxedStrategy<Vec<MirScalarExpr>>, BoxedStrategy<Vec<MirScalarExpr>>), fn(_: (SafeMfpPlan, Vec<MirScalarExpr>, Vec<MirScalarExpr>)) -> MfpPlan>
Strategy
used to generate values of type Self
.source§fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
fn arbitrary_with(_top: Self::Parameters) -> Self::Strategy
source§impl RustType<ProtoMfpPlan> for MfpPlan
impl RustType<ProtoMfpPlan> for MfpPlan
source§fn into_proto(&self) -> ProtoMfpPlan
fn into_proto(&self) -> ProtoMfpPlan
Self
into a Proto
value.source§fn from_proto(proto: ProtoMfpPlan) -> Result<Self, TryFromProtoError>
fn from_proto(proto: ProtoMfpPlan) -> Result<Self, TryFromProtoError>
source§fn into_proto_owned(self) -> Proto
fn into_proto_owned(self) -> Proto
Self::into_proto
that types can
optionally implement, otherwise, the default implementation
delegates to Self::into_proto
.impl StructuralPartialEq for MfpPlan
Auto Trait Implementations§
impl Freeze for MfpPlan
impl RefUnwindSafe for MfpPlan
impl Send for MfpPlan
impl Sync for MfpPlan
impl Unpin for MfpPlan
impl UnwindSafe for MfpPlan
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)source§impl<T> FutureExt for T
impl<T> FutureExt for T
source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T
in a tonic::Request
source§impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
impl<T, U> OverrideFrom<Option<&T>> for Uwhere
U: OverrideFrom<T>,
source§impl<T> Pointable for T
impl<T> Pointable for T
source§impl<T> ProgressEventTimestamp for T
impl<T> ProgressEventTimestamp for T
source§impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
impl<P, R> ProtoType<R> for Pwhere
R: RustType<P>,
source§fn into_rust(self) -> Result<R, TryFromProtoError>
fn into_rust(self) -> Result<R, TryFromProtoError>
RustType::from_proto
.source§fn from_rust(rust: &R) -> P
fn from_rust(rust: &R) -> P
RustType::into_proto
.source§impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
impl<'a, S, T> Semigroup<&'a S> for Twhere
T: Semigroup<S>,
source§fn plus_equals(&mut self, rhs: &&'a S)
fn plus_equals(&mut self, rhs: &&'a S)
std::ops::AddAssign
, for types that do not implement AddAssign
.