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.
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.
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.
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_len
Count the number of real fields. We should expand the wildcard expression to get the actual number.
exprlist_to_columnsDeprecated
Recursively walk a list of expression trees, collecting the unique set of columns referenced in the expression
exprlist_to_fields
Create field meta-data from an expression, for use in a result set schema
find_aggregate_exprs
Collect all deeply nested Expr::AggregateFunction. They are returned in order of occurrence (depth first), with duplicates omitted.
find_base_plan
Find the suitable base plan to expand the wildcard expression recursively. When planning LogicalPlan::Window and LogicalPlan::Aggregate, we will generate an intermediate plan based on the relation plan (e.g. LogicalPlan::TableScan, LogicalPlan::Subquery, …). If we expand a wildcard expression basing the intermediate plan, we could get some duplicate fields.
find_column_exprs
Collect all deeply nested Expr::Column’s. They are returned in order of appearance (depth first), and may contain duplicates.
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
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.
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_schema
merge inputs schema into a single schema.
only_or_err
Returns the first (and only) element in a slice, or an error
split_binary
Splits an binary operator tree Expr such as A <OP> B <OP> C => [A, B, C]
split_binary_owned
Splits an owned binary operator tree Expr such as A <OP> B <OP> C => [A, B, C]
split_conjunction
Splits a conjunctive Expr such as A AND B AND C => [A, B, C]
split_conjunction_owned
Splits an owned conjunctive Expr such as A AND B AND C => [A, B, C]