Enum sql::plan::expr::HirRelationExpr[][src]

pub enum HirRelationExpr {
Show 15 variants Constant { rows: Vec<Row>, typ: RelationType, }, Get { id: Id, typ: RelationType, }, Let { name: String, id: LocalId, value: Box<HirRelationExpr>, body: Box<HirRelationExpr>, }, Project { input: Box<HirRelationExpr>, outputs: Vec<usize>, }, Map { input: Box<HirRelationExpr>, scalars: Vec<HirScalarExpr>, }, CallTable { func: TableFunc, exprs: Vec<HirScalarExpr>, }, Filter { input: Box<HirRelationExpr>, predicates: Vec<HirScalarExpr>, }, Join { left: Box<HirRelationExpr>, right: Box<HirRelationExpr>, on: HirScalarExpr, kind: JoinKind, }, Reduce { input: Box<HirRelationExpr>, group_key: Vec<usize>, aggregates: Vec<AggregateExpr>, expected_group_size: Option<usize>, }, Distinct { input: Box<HirRelationExpr>, }, TopK { input: Box<HirRelationExpr>, group_key: Vec<usize>, order_key: Vec<ColumnOrder>, limit: Option<usize>, offset: usize, }, Negate { input: Box<HirRelationExpr>, }, Threshold { input: Box<HirRelationExpr>, }, Union { base: Box<HirRelationExpr>, inputs: Vec<HirRelationExpr>, }, DeclareKeys { input: Box<HirRelationExpr>, keys: Vec<Vec<usize>>, },
}
Expand description

Just like MirRelationExpr, except where otherwise noted below.

Variants

Constant

Fields

rows: Vec<Row>

Get

Fields

id: Id

Let

Fields

name: String
id: LocalId

The identifier to be used in Get variants to retrieve value.

value: Box<HirRelationExpr>

The collection to be bound to name.

body: Box<HirRelationExpr>

The result of the Let, evaluated with name bound to value.

CTE

Project

Fields

outputs: Vec<usize>

Map

Fields

scalars: Vec<HirScalarExpr>

CallTable

Fields

func: TableFunc

Filter

Fields

predicates: Vec<HirScalarExpr>

Join

Fields

kind: JoinKind

Unlike MirRelationExpr, we haven’t yet compiled LeftOuter/RightOuter/FullOuter joins away into more primitive exprs

Reduce

Fields

group_key: Vec<usize>
aggregates: Vec<AggregateExpr>
expected_group_size: Option<usize>

Unlike MirRelationExpr, when key is empty AND input is empty this returns a single row with the aggregates evaluated over empty groups, rather than returning zero rows

Distinct

Fields

TopK

Fields

input: Box<HirRelationExpr>

The source collection.

group_key: Vec<usize>

Column indices used to form groups.

order_key: Vec<ColumnOrder>

Column indices used to order rows within groups.

limit: Option<usize>

Number of records to retain

offset: usize

Number of records to skip

Groups and orders within each group, limiting output.

Negate

Fields

Threshold

Fields

Union

Fields

DeclareKeys

Fields

keys: Vec<Vec<usize>>

Implementations

Pretty-print this HirRelationExpr to a string.

Reports whether this expression contains a column reference to its direct parent scope.

Visits all scalar expressions within the sub-tree of the given relation.

The depth argument should indicate the subquery nesting depth of the expression, which will be incremented when entering the RHS of a join or a subquery and presented to the supplied function f.

Like visit_scalar_expressions, but permits mutating the expressions.

Visits the column references in this relation expression.

The depth argument should indicate the subquery nesting depth of the expression, which will be incremented when entering the RHS of a join or a subquery and presented to the supplied function f.

Like visit_columns, but permits mutating the column references.

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

See the documentation for HirScalarExpr::splice_parameters.

Constructs a constant collection from specific rows and schema.

Rewrite self into a expr::MirRelationExpr. This requires rewriting all correlated subqueries (nested HirRelationExprs) into flat queries

Return a expr::MirRelationExpr which evaluates self once for each row of get_outer.

For uncorrelated self, this should be the cross-product between get_outer and self. When self references columns of get_outer, much more work needs to occur.

The col_map argument contains mappings to some of the columns of get_outer, though perhaps not all of them. It should be used as the basis of resolving column references, but care must be taken when adding new columns that get_outer.arity() is where they will start, rather than any function of col_map.

The get_outer expression should be a Get with no duplicate rows, describing the distinct assignment of values to outer rows.

Perform optimizing algebraic rewrites on this HirRelationExpr and lower it to a expr::MirRelationExpr.

The optimization path is fully-determined by the values of the feature flag defined in the OptimizerConfig.

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

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