Module utils

Module utils 

Source
Expand description

Expression utilities

Enums§

AggregateOrderSensitivity
Represents the sensitivity of an aggregate expression to ordering.

Constants§

COUNT_STAR_EXPANSION
The value to which COUNT(*) is expanded to in COUNT(<constant>) expressions The value to which COUNT(*) is expanded to in COUNT(<constant>) expressions

Functions§

add_filter
Returns a new LogicalPlan that filters the output of plan with a LogicalPlan::Filter with all predicates ANDed.
can_hash
Can this data type be used in hash join equal conditions?? Data types here come from function ‘equal_rows’, if more data types are supported in create_hashes, add those data types here to generate join logical plan.
check_all_columns_from_schema
Check whether all columns are from the schema.
check_grouping_set_size_limit 🔒
check the number of expressions contained in the grouping_set
check_grouping_sets_size_limit 🔒
check the number of grouping_set contained in the grouping sets
collect_subquery_cols
Determine the set of Columns produced by the subquery.
columnize_expr
Convert an expression into Column expression if it’s already provided as input plan.
compare_sort_expr
Compare the sort expr as PostgreSQL’s common_prefix_cmp(): https://github.com/postgres/postgres/blob/master/src/backend/optimizer/plan/planner.c
conjunction
Combines an array of filter expressions into a single filter expression consisting of the input filter expressions joined with logical AND.
cross_join_grouping_sets 🔒
Compute the cross product of two grouping_sets
disjunction
Combines an array of filter expressions into a single filter expression consisting of the input filter expressions joined with logical OR.
enumerate_grouping_sets
Convert multiple grouping expressions into one GroupingSet::GroupingSets,
if the grouping expression does not contain Expr::GroupingSet or only has one expression,
no conversion will be performed.
exclude_using_columns 🔒
For each column specified in the USING JOIN condition, the JOIN plan outputs it twice (once for each join side), but an unqualified wildcard should include it only once. This function returns the columns that should be excluded.
expand_qualified_wildcard
Resolves an Expr::Wildcard to a collection of qualified Expr::Column’s.
expand_wildcard
Resolves an Expr::Wildcard to a collection of Expr::Column’s.
expr_as_column_expr
Convert any Expr to an Expr::Column.
expr_to_columns
Recursively walk an expression tree, collecting the unique set of columns referenced in the expression
exprlist_to_fields
Create schema fields from an expression list, for use in result set schema construction
find_aggregate_exprs
Collect all deeply nested Expr::AggregateFunction. They are returned in order of occurrence (depth first), with duplicates omitted.
find_column_exprs
Collect all deeply nested Expr::Column’s. They are returned in order of appearance (depth first), and may contain duplicates.
find_column_indexes_referenced_by_expr 🔒
Recursively walk an expression tree, collecting the column indexes referenced in the expression
find_columns_referenced_by_expr 🔒
find_exprs_in_expr 🔒
Search an Expr, and all of its nested Expr’s, for any that pass the provided test. The returned Expr’s are deduplicated and returned in order of appearance (depth first). todo: document about that columns may refer to a lambda parameter?
find_exprs_in_exprs 🔒
Search the provided Expr’s, and all of their nested Expr, for any that pass the provided test. The returned Expr’s are deduplicated and returned in order of appearance (depth first).
find_join_exprs
Looks for correlating expressions: for example, a binary expression with one field from the subquery, and one not in the subquery (closed upon from outer scope)
find_out_reference_exprs
Collect all deeply nested Expr::OuterReferenceColumn. They are returned in order of occurrence (depth first), with duplicates omitted.
find_valid_equijoin_key_pair
Give two sides of the equijoin predicate, return a valid join key pair. If there is no valid join key pair, return None.
find_window_exprs
Collect all deeply nested Expr::WindowFunction. They are returned in order of occurrence (depth first), with duplicates omitted.
format_state_name
Build state name. State is the intermediate state of the aggregate function.
generate_signature_error_msg
Creates a detailed error message for a function with wrong signature.
generate_sort_key
Generate a sort key for a given window expr’s partition_by and order_by expr
get_excluded_columns 🔒
Find excluded columns in the schema, if any SELECT * EXCLUDE(col1, col2), would return vec![col1, col2]
get_exprs_except_skipped 🔒
Returns all Exprs in the schema, except the Columns in the columns_to_skip
group_window_expr_by_sort_keys
Group a slice of window expression expr by their order by expressions
grouping_set_expr_count
Count the number of distinct exprs in a list of group by expressions. If the first element is a GroupingSet expression then it must be the only expr.
grouping_set_to_exprlist
Find all distinct exprs in a list of group by expressions. If the first element is a GroupingSet expression then it must be the only expr.
inspect_expr_pre
Recursively inspect an Expr and all its children. todo: document about that columns may refer to a lambda parameter?
iter_conjunction
Iterate parts in a conjunctive Expr such as A AND B AND C => [A, B, C]
iter_conjunction_owned
Iterate parts in a conjunctive Expr such as A AND B AND C => [A, B, C]
merge_grouping_set 🔒
Merge two grouping_set
merge_schema
merge inputs schema into a single schema.
only_or_err
Returns the first (and only) element in a slice, or an error
powerset 🔒
The power set (or powerset) of a set S is the set of all subsets of S,
including the empty set and S itself.
split_binary
Splits an binary operator tree Expr such as A <OP> B <OP> C => [A, B, C]
split_binary_impl 🔒
split_binary_owned
Splits an owned binary operator tree Expr such as A <OP> B <OP> C => [A, B, C]
split_binary_owned_impl 🔒
split_conjunction
Splits a conjunctive Expr such as A AND B AND C => [A, B, C]
split_conjunction_impl 🔒
split_conjunction_owned
Splits an owned conjunctive Expr such as A AND B AND C => [A, B, C]

Type Aliases§

WindowSortKey 🔒
(expr, “is the SortExpr for window (either comes from PARTITION BY or ORDER BY columns)”) If bool is true SortExpr comes from PARTITION BY column, if false comes from ORDER BY column