Enum sql::plan::HirScalarExpr[][src]

pub enum HirScalarExpr {
    Column(ColumnRef),
    Parameter(usize),
    Literal(RowColumnType),
    CallNullary(NullaryFunc),
    CallUnary {
        func: UnaryFunc,
        expr: Box<HirScalarExpr>,
    },
    CallBinary {
        func: BinaryFunc,
        expr1: Box<HirScalarExpr>,
        expr2: Box<HirScalarExpr>,
    },
    CallVariadic {
        func: VariadicFunc,
        exprs: Vec<HirScalarExpr>,
    },
    If {
        cond: Box<HirScalarExpr>,
        then: Box<HirScalarExpr>,
        els: Box<HirScalarExpr>,
    },
    Exists(Box<HirRelationExpr>),
    Select(Box<HirRelationExpr>),
    Windowing(WindowExpr),
}
Expand description

Just like expr::MirScalarExpr, except where otherwise noted below.

Variants

Column(ColumnRef)

Tuple Fields

Unlike expr::MirScalarExpr, we can nest HirRelationExprs via eg Exists. This means that a variable could refer to a column of the current input, or to a column of an outer relation. We use ColumnRef to denote the difference.

Parameter(usize)

Tuple Fields

0: usize

Literal(RowColumnType)

Tuple Fields

0: Row

CallNullary(NullaryFunc)

Tuple Fields

CallUnary

Fields

func: UnaryFunc

CallBinary

Fields

func: BinaryFunc

CallVariadic

Fields

If

Fields

Exists(Box<HirRelationExpr>)

Tuple Fields

Returns true if expr returns any rows

Select(Box<HirRelationExpr>)

Tuple Fields

Given expr with arity 1. If expr returns:

Windowing(WindowExpr)

Tuple Fields

Implementations

Replaces any parameter references in the expression with the corresponding datum in params.

Like HirScalarExpr::bind_parameters, except that parameters are replaced with the corresponding expression fragment from params rather than a datum.

Specifically, the parameter $1 will be replaced with params[0], the parameter $2 will be replaced with params[1], and so on. Parameters in self that refer to invalid indices of params will cause a panic.

Column references in parameters will be corrected to account for the depth at which they are spliced.

Constructs a column reference in the current scope.

pub fn 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 HirScalarExpr before it runs on any of the child HirScalarExprs. The function post runs on child HirScalarExprs first before the parent. Optionally, pre can return which child HirScalarExprs, if any, should be visited (default is to visit all children).

Visits the column references in this scalar expression.

The depth argument should indicate the subquery nesting depth of the expression, which will be incremented with each subquery entered and presented to the supplied function f.

Like visit_columns, but permits mutating the column references.

Like visit but it enters the subqueries visiting the scalar expressions contained in them. It takes the current depth of the expression and increases it when entering a subquery.

Like visit_recursively, but permits mutating the scalar expressions.

Attempts to simplify this expression to a literal 64-bit integer.

Returns None if this expression cannot be simplified, e.g. because it contains non-literal values.

Panics

Panics if this expression does not have type ScalarType::Int64.

Attempts to simplify this expression to a literal string.

Returns None if this expression cannot be simplified, e.g. because it contains non-literal values.

Panics

Panics if this expression does not have type ScalarType::String.

Rewrite self into a expr::ScalarExpr which can be applied to the modified inner.

This method is responsible for decorrelating subqueries in self by introducing further columns to inner, and rewriting self to refer to its physical columns (specified by usize positions). The most complicated logic is for the scalar expressions that involve subqueries, each of which are documented in more detail closer to their logic.

This process presumes that inner is the result of decorrelation, meaning its first several columns may be inherited from outer relations. The col_map column map should provide specific offsets where each of these references can be found.

Applies the subqueries in the given list of scalar expressions to every distinct value of the given relation and returns a join of the given relation with all the subqueries found, and the mapping of scalar expressions with columns projected by the returned join that will hold their results.

Rewrites self into a expr::ScalarExpr.

Trait Implementations

Computes the type of the expression.

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Feeds this value into the given Hasher. Read more

Feeds a slice of this type into the given Hasher. 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

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

Performs the conversion.

The type of the output value.

A well-distributed integer derived from the data.

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

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