Expand description
Defines the projection execution plan. A projection determines which columns or expressions
are returned from a query. The SQL statement SELECT a, b, a+b FROM t1 is an example
of a projection on table t1 where the expressions a, b, and a+b are the
projection expressions. SELECT without FROM will only evaluate expressions.
Structs§
- Join
Data - Projection
Exec ExecutionPlanfor a projection- Projection
Expr - A projection expression as used by projection operations.
- Projection
Exprs - A collection of projection expressions.
- Projection
Stream 🔒 - Projection iterator
Traits§
Functions§
- all_
alias_ free_ columns - Given the expression set of a projection, checks if the projection causes
any renaming or constructs a non-
Columnphysical expression. - all_
columns - Returns
trueif all the expressions in the argument areColumns. - collect_
column_ 🔒indices - Collect all column indices from the given projection expressions.
- is_
expr_ 🔒trivial - Checks if the given expression is trivial.
An expression is considered trivial if it is either a
Columnor aLiteral. - is_
projection_ 🔒removable - Compare the inputs and outputs of the projection. All expressions must be
columns without alias, and projection does not change the order of fields.
For example, if the input schema is
a, b,SELECT a, bis removable, butSELECT b, aandSELECT a+1, bandSELECT a AS c, bare not. - join_
allows_ pushdown - Checks three conditions for pushing a projection down through a join:
- join_
table_ borders - Returns the last index before encountering a column coming from the right table when traveling through the projection from left to right, and the last index before encountering a column coming from the left table when traveling through the projection from right to left. If there is no column in the projection coming from the left side, it returns (-1, …), if there is no column in the projection coming from the right side, it returns (…, projection length).
- make_
with_ child - Creates a new
ProjectionExecinstance with the given child plan and projected expressions. - new_
columns_ 🔒for_ join_ on - This function generates a new set of columns to be used in a hash join
operation based on a set of equi-join conditions (
hash_join_on) and a list of projection expressions (projection_exprs). - new_
indices_ 🔒for_ join_ filter - This function determines and returns a vector of indices representing the
positions of columns in
projection_exprsthat are involved injoin_filter, and correspond to a particular side (join_side) of the join operation. - new_
join_ children - If pushing down the projection over this join’s children seems possible,
this function constructs the new
ProjectionExecs that will come on top of the original children of the join. - new_
projections_ for_ columns - Updates a source provider’s projected columns according to the given
projection operator’s expressions. To use this function safely, one must
ensure that all expressions are
Columnexpressions without aliases. - physical_
to_ column_ exprs - Downcasts all the expressions in
exprstoColumns. If any of the given expressions is not aColumn, returnsNone. - remove_
unnecessary_ projections - This function checks if
planis aProjectionExec, and inspects its input(s) to test whether it can pushplanunder its input(s). This function will operate on the entire tree and may ultimately removeplanentirely by leveraging source providers with built-in projection capabilities. - try_
embed_ projection - Some projection can’t be pushed down left input or right input of hash join because filter or on need may need some columns that won’t be used in later. By embed those projection to hash join, we can reduce the cost of build_batch_from_indices in hash join (build_batch_from_indices need to can compute::take() for each column) and avoid unnecessary output creation.
- try_
pushdown_ through_ join - try_
unifying_ 🔒projections - Unifies
projectionwith its input (which is also aProjectionExec). - update_
expr - The function operates in two modes:
- update_
join_ filter - Tries to update the column indices of a
JoinFilteras if the input of the join was replaced by a projection. - update_
join_ on - Tries to update the equi-join
Column’s of a join as if the input of the join was replaced by a projection. - update_
ordering - Updates the given lexicographic ordering according to given projected
expressions using the
update_exprfunction. - update_
ordering_ requirement - Updates the given lexicographic requirement according to given projected
expressions using the
update_exprfunction.