Enum sql::query_model::model::scalar::BoxScalarExpr[][src]

pub(crate) enum BoxScalarExpr {
    ColumnReference(ColumnReference),
    BaseColumn(BaseColumn),
    Literal(RowColumnType),
    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

A leaf column. Only allowed as standalone expressions in the projection of BaseTable and TableFunction boxes.

Literal(RowColumnType)

Tuple Fields

0: Row

A literal value. (A single datum stored as a row, because we can’t own a Datum)

CallNullary(NullaryFunc)

Tuple Fields

CallUnary

Fields

func: UnaryFunc

CallBinary

Fields

func: BinaryFunc

CallVariadic

Fields

If

Fields

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

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_post<F>(&mut self, f: &mut F) where
    F: FnMut(&mut Self), 

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Formats an object with the “alternative” format ({:#}) and returns it.

Performs the conversion.

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

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

Performs the conversion.

Upcasts this ProgressEventTimestamp to Any. Read more

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

Should always be Self

The resulting type after obtaining ownership.

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

🔬 This is a nightly-only experimental API. (toowned_clone_into)

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

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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