Modulesยง
- agg_
call ๐ - correlated_
input_ ๐ref - expr_
mutator ๐ - expr_
rewriter ๐ - expr_
visitor ๐ - function_
call ๐ - input_
ref ๐ - literal ๐
- now ๐
- order_
by_ ๐expr - parameter ๐
- pure ๐
- session_
timezone ๐ - subquery ๐
- table_
function ๐ - type_
inference ๐This type inference is just to infer the return type of function calls, and make sure the functionCall expressions have same input type requirement and return type definition as backend. - utils ๐
- window_
function ๐
Macrosยง
- impl_
expr_ ๐impl - impl_
has_ ๐variant Implement helper functions which recursively checks whether an variant is included in the expression. e.g.,has_subquery(&self) -> bool
Structsยง
- Collect all
InputRef
sโ indexes in the expression. - for every
(col) == (col)
, transform toIsNotNull(col)
since in the boolean context,null = (...)
will always be treated as false. note: as always, only for single column. - A reference to a column outside the subquery.
- Count
Now
s in the expression. - A function signature.
- Similar to
FunctionCall
, with an extra lambda function argument. - Expression rewriter to inline
NOW()
andPROCTIME()
to a literal extracted from the epoch. - The
NOW()
function. - See
OrderByExpr
. - A sort expression in the
ORDER BY
clause. SessionTimezone
will be used to resolve session timezone-dependent casts, comparisons or arithmetic.- Subquery expression.
- A table function takes a row as input and returns a table. It is also known as Set-Returning Function.
- A window function performs a calculation across a set of table rows that are somehow related to the current row, according to the window spec
OVER (PARTITION BY .. ORDER BY ..)
. One output row is calculated for each row in the input table.
Enumsยง
- The context a cast operation is invoked in. An implicit cast operation is allowed in a context that allows explicit casts, but not vice versa. See details in PG.
- TODO: move this into
FunctionCall
.
Constantsยง
- EXPR_
DEPTH_ ๐THRESHOLD - EXPR_
TOO_ ๐DEEP_ NOTICE
Traitsยง
- the trait of bound expressions
- with the same visit logic of
ExprVisitor
, but mutable. - By default,
ExprRewriter
simply traverses the expression tree and leaves nodes unchanged. Implementations can override a subset of methods and perform transformation on some particular types of expression. - Traverse an expression tree.
Functionsยง
- Find the
least_restrictive
type over a list ofexprs
, and add implicit cast when necessary. Used byVALUES
,CASE
,UNION
, etc. See PG. - Checks whether casting from
source
totarget
is ok inallows
context. - Collect all
InputRef
sโ indexes in the expressions. - check
ColumnSelfEqualRewriter
โs comment below. - The default implementation of
ExprRewriter::rewrite_expr
that simply dispatches to other methods based on the type of the expression. - The default implementation of
ExprVisitor::visit_expr
that simply dispatches to other methods based on the type of the expression. - fold boolean constants in boolean exprs e.g.
(A And false) Or true
will becomeTrue
- From all available functions in
sig_map
, find and return the best matchingFuncSign
for the providedfunc_name
andinputs
. This not only support exact function signature match, but can also matchsubstr(varchar, smallint)
or evensubstr(varchar, unknown)
tosubstr(varchar, int)
. - Infers the return type of a function. Returns
Err
if the function with specified data types is not supported on backend. - Expand
Type::Not
expressions. e.g. Not(A And B) will become (Not A) Or (Not B) - Transform a bool expression to Conjunctive form. e.g. given expression is (expr1 AND expr2 AND expr3) the function will return Vec[expr1, expr2, expr3].
- Transform a bool expression to Disjunctive form. e.g. given expression is (expr1 OR expr2 OR expr3) the function will return Vec[expr1, expr2, expr3].
- Try to get bool constant from a
ExprImpl
. Ifexpr
is not aExprImpl::Literal
, or the Literal is not a boolean, this function will return None. Otherwise it will return the boolean value.
Type Aliasesยง
- Alias for
Type
.