Struct mz_transform::cse::relation_cse::Bindings
source · pub struct Bindings {
bindings: BTreeMap<MirRelationExpr, u64>,
rebindings: BTreeMap<LocalId, LocalId>,
recursion_guard: RecursionGuard,
}
Expand description
Maintains Let
bindings in a compact, explicit representation.
The bindings
map contains neither Let
bindings nor two structurally
equivalent expressions.
The bindings can be interpreted as an ordered sequence of let bindings, ordered by their identifier, that should be applied in order before the use of the expression from which they have been extracted.
Fields§
§bindings: BTreeMap<MirRelationExpr, u64>
A list of let-bound expressions and their order / identifier.
rebindings: BTreeMap<LocalId, LocalId>
Mapping from conventional local Get
identifiers to new ones.
recursion_guard: RecursionGuard
Implementations§
source§impl Bindings
impl Bindings
sourcefn intern_expression(
&mut self,
relation: &mut MirRelationExpr
) -> Result<(), TransformError>
fn intern_expression( &mut self, relation: &mut MirRelationExpr ) -> Result<(), TransformError>
Replace relation
with an equivalent Get
expression referencing a location in bindings
.
The algorithm performs a post-order traversal of the expression tree, binding each distinct
expression to a new local identifier. It maintains the invariant that bindings
contains no
Let
expressions, nor any two structurally equivalent expressions.
Once each sub-expression is replaced by a canonical Get
expression, each expression is also
in a canonical representation, which is used to check for prior instances and drives re-use.
sourcefn populate_expression(self, expression: &mut MirRelationExpr)
fn populate_expression(self, expression: &mut MirRelationExpr)
Populates expression
with necessary Let
bindings.
This population may result in substantially more Let
bindings that one
might expect. It is very appropriate to run the NormalizeLets
transformation
afterwards to remove Let
bindings that it deems unhelpful.
Trait Implementations§
source§impl CheckedRecursion for Bindings
impl CheckedRecursion for Bindings
source§fn recursion_guard(&self) -> &RecursionGuard
fn recursion_guard(&self) -> &RecursionGuard
source§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>,
f
if so. Read moresource§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>,
CheckedRecursion::checked_recur
, but operates on a mutable
reference to Self
.Auto Trait Implementations§
impl !RefUnwindSafe for Bindings
impl Send for Bindings
impl !Sync for Bindings
impl Unpin for Bindings
impl UnwindSafe for Bindings
Blanket Implementations§
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> Pointable for T
impl<T> Pointable 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
.