Module tidb_query_expr::types::function [−][src]
People implementing RPN functions with fixed argument type and count don’t necessarily
need to understand how Evaluator
and RpnDef
work. There’s a procedural macro called
rpn_fn
defined in tidb_query_codegen
to help you create RPN functions. For example:
use tidb_query_codegen::rpn_fn; #[rpn_fn(nullable)] fn foo(lhs: &Option<Int>, rhs: &Option<Int>) -> Result<Option<Int>> { // Your RPN function logic }
You can still call the foo
function directly; the macro preserves the original function
It creates a foo_fn_meta()
function (simply add _fn_meta
to the original
function name) which generates an RpnFnMeta
struct.
For more information on the procedural macro, see the documentation in
components/tidb_query_codegen/src/rpn_function
.
Structs
Arg | RPN function argument definitions in the form of a linked list. |
ArgConstructor | |
Null | Represents the end of the argument list. |
RpnFnCallExtra | Extra information about an RPN function call. |
RpnFnMeta | Metadata of an RPN function. |
ScalarArg | Represents an RPN function argument of a |
VectorArg | Represents an RPN function argument of a |
Constants
RAW_VARG_PARAM_BUF | |
VARG_PARAM_BUF | |
VARG_PARAM_BUF_BYTES_REF | |
VARG_PARAM_BUF_JSON_REF |
Traits
ArgDef | Partial or complete argument definition of an RPN function. |
Evaluator | A generic evaluator of an RPN function. |
RpnFnArg | A single argument of an RPN function. |
Functions
extract_metadata_from_val | |
validate_expr_arguments_eq | Validates whether the number of arguments of an expression node meets expectation. |
validate_expr_arguments_gte | Validates whether the number of arguments of an expression node >= expectation. |
validate_expr_arguments_lte | Validates whether the number of arguments of an expression node <= expectation. |
validate_expr_return_type | Validates whether the return type of an expression node meets expectation. |