Enum sql::query_model::model::scalar::BoxScalarExpr [−][src]
pub(crate) enum BoxScalarExpr {
ColumnReference(ColumnReference),
BaseColumn(BaseColumn),
Literal(Row, ColumnType),
CallNullary(NullaryFunc),
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)
Tuple Fields
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)
Tuple Fields
0: 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)
CallNullary(NullaryFunc)
Tuple Fields
0: NullaryFunc
CallUnary
CallBinary
CallVariadic
If
Aggregate
Fields
func: AggregateFunc
Names the aggregation function.
expr: Box<BoxScalarExpr>
An expression which extracts from each row the input to func
.
distinct: bool
Should the aggregation be applied only to distinct results in each group.
Implementations
A generalization of visit
. The function pre
runs on a
BoxScalarExpr
before it runs on any of the child BoxScalarExpr
s.
The function post
runs on child BoxScalarExpr
s first before the
parent. Optionally, pre
can return which child BoxScalarExpr
s, if
any, should be visited (default is to visit all children).
pub fn collect_column_references_from_context(
&self,
context: &BTreeSet<QuantifierId>,
column_refs: &mut HashSet<ColumnReference>
)
Trait Implementations
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
This method tests for !=
.
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
Mutably borrows from an owned value. Read more
Formats an object with the “alternative” format ({:#}
) and returns it.
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more