Enum mz_sql::query_model::model::scalar::BoxScalarExpr
source · pub(crate) enum BoxScalarExpr {
ColumnReference(ColumnReference),
BaseColumn(BaseColumn),
Literal(Row, ColumnType),
CallUnmaterializable(UnmaterializableFunc),
CallUnary {
func: UnaryFunc,
expr: Box<BoxScalarExpr>,
},
CallBinary {
func: BinaryFunc,
expr1: Box<BoxScalarExpr>,
expr2: Box<BoxScalarExpr>,
},
CallVariadic {
func: VariadicFunc,
exprs: Vec<BoxScalarExpr>,
},
If {
cond: Box<BoxScalarExpr>,
then: Box<BoxScalarExpr>,
els: Box<BoxScalarExpr>,
},
Aggregate {
func: AggregateFunc,
expr: Box<BoxScalarExpr>,
distinct: bool,
},
}Expand description
Representation for scalar expressions within a query graph model.
Similar to HirScalarExpr but:
- subqueries are represented as column references to the subquery quantifiers within the same box the expression belongs to,
- aggregate expressions are considered scalar expressions here even though they are only valid in the context of a Grouping box,
- column references are represented by a pair (quantifier ID, column position),
- BaseColumn is used to represent leaf columns, only allowed in the projection of BaseTables and TableFunctions.
Scalar expressions only make sense within the context of a
super::graph::QueryBox, and hence, their name.
Variants§
ColumnReference(ColumnReference)
A reference to a column from a quantifier that either lives in the same box as the expression or is a sibling quantifier of an ascendent box of the box that contains the expression.
BaseColumn(BaseColumn)
A leaf column. Only allowed as standalone expressions in the
projection of BaseTable and TableFunction boxes.
Literal(Row, ColumnType)
A literal value. (A single datum stored as a row, because we can’t own a Datum)
CallUnmaterializable(UnmaterializableFunc)
CallUnary
CallBinary
CallVariadic
If
Aggregate
Fields
func: AggregateFuncNames the aggregation function.
expr: Box<BoxScalarExpr>An expression which extracts from each row the input to func.
Implementations§
source§impl BoxScalarExpr
impl BoxScalarExpr
pub fn visit_children<'a, F>(&'a self, f: F)where
F: FnMut(&'a Self),
sourcepub fn try_visit_pre_post<F1, F2>(&self, pre: &mut F1, post: &mut F2)where
F1: FnMut(&Self) -> Option<Vec<&Self>>,
F2: FnMut(&Self),
pub fn try_visit_pre_post<F1, F2>(&self, pre: &mut F1, post: &mut F2)where
F1: FnMut(&Self) -> Option<Vec<&Self>>,
F2: FnMut(&Self),
A generalization of visit. The function pre runs on a
BoxScalarExpr before it runs on any of the child BoxScalarExprs.
The function post runs on child BoxScalarExprs first before the
parent. Optionally, pre can return which child BoxScalarExprs, if
any, should be visited (default is to visit all children).
pub fn visit_mut_children<'a, F>(&'a mut self, f: F)where
F: FnMut(&'a mut Self),
pub fn visit_post<F>(&self, f: &mut F)where
F: FnMut(&Self),
pub fn visit_mut_post<F>(&mut self, f: &mut F)where
F: FnMut(&mut Self),
pub fn collect_column_references_from_context(
&self,
context: &BTreeSet<QuantifierId>,
column_refs: &mut HashSet<ColumnReference>
)
Trait Implementations§
source§impl Clone for BoxScalarExpr
impl Clone for BoxScalarExpr
source§fn clone(&self) -> BoxScalarExpr
fn clone(&self) -> BoxScalarExpr
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moresource§impl Debug for BoxScalarExpr
impl Debug for BoxScalarExpr
source§impl Display for BoxScalarExpr
impl Display for BoxScalarExpr
source§impl PartialEq<BoxScalarExpr> for BoxScalarExpr
impl PartialEq<BoxScalarExpr> for BoxScalarExpr
source§fn eq(&self, other: &BoxScalarExpr) -> bool
fn eq(&self, other: &BoxScalarExpr) -> bool
self and other values to be equal, and is used
by ==.impl StructuralPartialEq for BoxScalarExpr
Auto Trait Implementations§
impl RefUnwindSafe for BoxScalarExpr
impl Send for BoxScalarExpr
impl Sync for BoxScalarExpr
impl Unpin for BoxScalarExpr
impl UnwindSafe for BoxScalarExpr
Blanket Implementations§
source§impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
impl<T> CloneDebuggableStorage for Twhere
T: DebuggableStorage + Clone,
fn clone_storage(&self) -> Box<dyn CloneDebuggableStorage + 'static, Global>
source§impl<T> CloneableStorage for Twhere
T: Any + Send + Sync + Clone,
impl<T> CloneableStorage for Twhere
T: Any + Send + Sync + Clone,
fn clone_storage(&self) -> Box<dyn CloneableStorage + 'static, Global>
source§impl<T> DisplayExt for Twhere
T: Display,
impl<T> DisplayExt for Twhere
T: Display,
source§fn to_string_alt(&self) -> String
fn to_string_alt(&self) -> String
{:#}) and returns it.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::Requestsource§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.