Struct mz_expr::OptimizedMirRelationExpr

source ·
pub struct OptimizedMirRelationExpr(pub MirRelationExpr);
Expand description

A MirRelationExpr that claims to have been optimized, e.g., by an transform::Optimizer.

Tuple Fields§

§0: MirRelationExpr

Implementations§

source§

impl OptimizedMirRelationExpr

source

pub fn declare_optimized(expr: MirRelationExpr) -> OptimizedMirRelationExpr

Declare that the input expr is optimized, without actually running it through an optimizer. This can be useful to mark as optimized literal MirRelationExprs that are obviously optimal, without invoking the whole machinery of the optimizer.

source

pub fn as_inner(&self) -> &MirRelationExpr

Get mutable access to the inner MirRelationExpr

Callers of this method need to ensure that the underlying expression stays optimized after any mutations are applied

source

pub fn as_inner_mut(&mut self) -> &mut MirRelationExpr

Get mutable access to the inner MirRelationExpr

Callers of this method need to ensure that the underlying expression stays optimized after any mutations are applied

source

pub fn into_inner(self) -> MirRelationExpr

Methods from Deref<Target = MirRelationExpr>§

source

pub fn typ(&self) -> RelationType

Reports the schema of the relation.

This method determines the type through recursive traversal of the relation expression, drawing from the types of base collections. As such, this is not an especially cheap method, and should be used judiciously.

The relation type is computed incrementally with a recursive post-order traversal, that accumulates the input types for the relations yet to be visited in type_stack.

source

pub fn typ_with_input_types(&self, input_types: &[RelationType]) -> RelationType

Reports the schema of the relation given the schema of the input relations.

input_types is required to contain the schemas for the input relations of the current relation in the same order as they are visited by try_visit_children method, even though not all may be used for computing the schema of the current relation. For example, Let expects two input types, one for the value relation and one for the body, in that order, but only the one for the body is used to determine the type of the Let relation.

It is meant to be used during post-order traversals to compute relation schemas incrementally.

source

pub fn col_with_input_cols<'a, I>(&self, input_types: I) -> Vec<ColumnType>
where I: Iterator<Item = &'a Vec<ColumnType>>,

Reports the column types of the relation given the column types of the input relations.

This method delegates to try_col_with_input_cols, panicing if an Err variant is returned.

source

pub fn try_col_with_input_cols<'a, I>( &self, input_types: I ) -> Result<Vec<ColumnType>, String>
where I: Iterator<Item = &'a Vec<ColumnType>>,

Reports the column types of the relation given the column types of the input relations.

input_types is required to contain the column types for the input relations of the current relation in the same order as they are visited by try_visit_children method, even though not all may be used for computing the schema of the current relation. For example, Let expects two input types, one for the value relation and one for the body, in that order, but only the one for the body is used to determine the type of the Let relation.

It is meant to be used during post-order traversals to compute column types incrementally.

source

pub fn keys_with_input_keys<'a, I, J>( &self, input_arities: I, input_keys: J ) -> Vec<Vec<usize>>
where I: Iterator<Item = usize>, J: Iterator<Item = &'a Vec<Vec<usize>>>,

Reports the unique keys of the relation given the arities and the unique keys of the input relations.

input_arities and input_keys are required to contain the corresponding info for the input relations of the current relation in the same order as they are visited by try_visit_children method, even though not all may be used for computing the schema of the current relation. For example, Let expects two input types, one for the value relation and one for the body, in that order, but only the one for the body is used to determine the type of the Let relation.

It is meant to be used during post-order traversals to compute unique keys incrementally.

source

pub fn arity(&self) -> usize

The number of columns in the relation.

This number is determined from the type, which is determined recursively at non-trivial cost.

The arity is computed incrementally with a recursive post-order traversal, that accumulates the arities for the relations yet to be visited in arity_stack.

source

pub fn arity_with_input_arities<I>(&self, input_arities: I) -> usize
where I: Iterator<Item = usize>,

Reports the arity of the relation given the schema of the input relations.

input_arities is required to contain the arities for the input relations of the current relation in the same order as they are visited by try_visit_children method, even though not all may be used for computing the schema of the current relation. For example, Let expects two input types, one for the value relation and one for the body, in that order, but only the one for the body is used to determine the type of the Let relation.

It is meant to be used during post-order traversals to compute arities incrementally.

source

pub fn num_inputs(&self) -> usize

The number of child relations this relation has.

source

pub fn as_const( &self ) -> Option<(&Result<Vec<(Row, Diff)>, EvalError>, &RelationType)>

If self is a constant, return the value and the type, otherwise None. Looks behind ArrangeBys.

source

pub fn as_const_err(&self) -> Option<&EvalError>

If self is a constant error, return the error, otherwise None. Looks behind ArrangeBys.

source

pub fn is_constant_singleton(&self) -> bool

Checks if self is the single element collection with no columns.

source

pub fn is_empty(&self) -> bool

Indicates if this is a constant empty collection.

A false value does not mean the collection is known to be non-empty, only that we cannot currently determine that it is statically empty.

source

pub fn is_negated_project(&self) -> Option<(&MirRelationExpr, &[usize])>

If the expression is a negated project, return the input and the projection.

source

pub fn pretty(&self) -> String

Pretty-print this MirRelationExpr to a string.

source

pub fn explain( &self, config: &ExplainConfig, humanizer: Option<&dyn ExprHumanizer> ) -> String

Pretty-print this MirRelationExpr to a string using a custom ExplainConfig and an optionally provided ExprHumanizer.

source

pub fn contains_temporal(&self) -> bool

True iff the expression contains a NullaryFunc::MzLogicalTimestamp.

source

pub fn try_visit_scalars_1<F, E>(&self, f: &mut F) -> Result<(), E>
where F: FnMut(&MirScalarExpr) -> Result<(), E>,

Fallible visitor for the MirScalarExprs directly owned by this relation expression.

The f visitor should not recursively descend into owned MirRelationExprs.

source

pub fn try_visit_scalars<F, E>(&self, f: &mut F) -> Result<(), E>

Fallible immutable visitor for the MirScalarExprs in the MirRelationExpr subtree rooted at self.

Note that this does not recurse into MirRelationExpr subtrees within MirScalarExpr nodes.

source

pub fn visit_scalars<F>(&self, f: &mut F)
where F: FnMut(&MirScalarExpr),

Infallible immutable visitor for the MirScalarExprs in the MirRelationExpr subtree rooted at at self.

Note that this does not recurse into MirRelationExpr subtrees within MirScalarExpr nodes.

source

pub fn debug_size_and_depth(&self) -> (usize, usize)

Computes the size (total number of nodes) and maximum depth of a MirRelationExpr for debug printing purposes.

source

pub fn could_run_expensive_function(&self) -> bool

The MirRelationExpr is considered potentially expensive if and only if at least one of the following conditions is true:

  • It contains at least one FlatMap or a Reduce operator.
  • It contains at least one MirScalarExpr with a function call.

!!!WARNING!!!: this method has an HirRelationExpr counterpart. The two should be kept in sync w.r.t. HIR ⇒ MIR lowering!

source

pub fn is_recursive(self: &MirRelationExpr) -> bool

True when expr contains a LetRec AST node.

source

pub fn size(&self) -> usize

Return the number of sub-expressions in the tree (including self).

source

pub fn children(&self) -> impl DoubleEndedIterator<Item = &Self>

Iterates through references to child expressions.

source

pub fn visit_pre<'a, F: FnMut(&'a Self)>(&'a self, f: F)

Iterative pre-order visitor.

source

pub fn post_order_vec(&self) -> Vec<&Self>

Return a vector of references to the subtrees of this expression in post-visit order (the last element is &self).

Trait Implementations§

source§

impl Clone for OptimizedMirRelationExpr

source§

fn clone(&self) -> OptimizedMirRelationExpr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl CollectionPlan for OptimizedMirRelationExpr

source§

fn depends_on_into(&self, out: &mut BTreeSet<GlobalId>)

Collects the set of global identifiers from dataflows referenced in Get.
source§

fn depends_on(&self) -> BTreeSet<GlobalId>

Returns the set of global identifiers from dataflows referenced in Get. Read more
source§

impl Debug for OptimizedMirRelationExpr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Deref for OptimizedMirRelationExpr

§

type Target = MirRelationExpr

The resulting type after dereferencing.
source§

fn deref(&self) -> &Self::Target

Dereferences the value.
source§

impl<'de> Deserialize<'de> for OptimizedMirRelationExpr

source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
source§

impl Hash for OptimizedMirRelationExpr

source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
source§

impl PartialEq for OptimizedMirRelationExpr

source§

fn eq(&self, other: &OptimizedMirRelationExpr) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for OptimizedMirRelationExpr

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl Eq for OptimizedMirRelationExpr

source§

impl StructuralPartialEq for OptimizedMirRelationExpr

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T, U> CastInto<U> for T
where U: CastFrom<T>,

source§

fn cast_into(self) -> U

Performs the cast.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T> FromRef<T> for T
where T: Clone,

source§

fn from_ref(input: &T) -> T

Converts to this type from a reference to the input type.
source§

impl<T> FutureExt for T

source§

fn with_context(self, otel_cx: Context) -> WithContext<Self>

Attaches the provided Context to this type, returning a WithContext wrapper. Read more
source§

fn with_current_context(self) -> WithContext<Self>

Attaches the current Context to this type, returning a WithContext wrapper. Read more
source§

impl<T> Hashable for T
where T: Hash,

§

type Output = u64

The type of the output value.
source§

fn hashed(&self) -> u64

A well-distributed integer derived from the data.
source§

impl<T> Instrument for T

source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoRequest<T> for T

source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
source§

impl<T, U> OverrideFrom<Option<&T>> for U
where U: OverrideFrom<T>,

source§

fn override_from(self, layer: &Option<&T>) -> U

Override the configuration represented by Self with values from the given layer.
source§

impl<T> Pointable for T

source§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> ProgressEventTimestamp for T
where T: Data + Debug + Any,

source§

fn as_any(&self) -> &(dyn Any + 'static)

Upcasts this ProgressEventTimestamp to Any. Read more
source§

fn type_name(&self) -> &'static str

Returns the name of the concrete type of this object. Read more
source§

impl<P, R> ProtoType<R> for P
where R: RustType<P>,

source§

impl<T> Same for T

§

type Output = T

Should always be Self
source§

impl<'a, S, T> Semigroup<&'a S> for T
where T: Semigroup<S>,

source§

fn plus_equals(&mut self, rhs: &&'a S)

The method of std::ops::AddAssign, for types that do not implement AddAssign.
source§

impl<T> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

source§

fn vzip(self) -> V

source§

impl<T> WithSubscriber for T

source§

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
source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
source§

impl<T> Allocation for T
where T: RefUnwindSafe + Send + Sync,

source§

impl<T> Data for T
where T: Clone + 'static,

source§

impl<T> Data for T
where T: Send + Sync + Any + Serialize + for<'a> Deserialize<'a> + 'static,

source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

source§

impl<T> ExchangeData for T
where T: Data + Data,

source§

impl<T> Sequence for T
where T: Eq + Hash,