risingwave_expr_macro

Struct FunctionAttr

source
pub(crate) struct FunctionAttr {
Show 14 fields pub(crate) name: String, pub(crate) args: Vec<String>, pub(crate) ret: String, pub(crate) is_table_function: bool, pub(crate) append_only: bool, pub(crate) batch_fn: Option<String>, pub(crate) state: Option<String>, pub(crate) init_state: Option<String>, pub(crate) prebuild: Option<String>, pub(crate) type_infer: Option<String>, pub(crate) generic: Option<String>, pub(crate) volatile: bool, pub(crate) deprecated: bool, pub(crate) rewritten: bool,
}

Fields§

§name: String

Function name

§args: Vec<String>

Input argument types

§ret: String

Return type

§is_table_function: bool

Whether it is a table function

§append_only: bool

Whether it is an append-only aggregate function

§batch_fn: Option<String>

Optional function for batch evaluation.

§state: Option<String>

State type for aggregate function. If not specified, it will be the same as return type.

§init_state: Option<String>

Initial state value for aggregate function. If not specified, it will be NULL.

§prebuild: Option<String>

Prebuild function for arguments. This could be any Rust expression.

§type_infer: Option<String>

Type inference function.

§generic: Option<String>

Generic type.

§volatile: bool

Whether the function is volatile.

§deprecated: bool

If true, the function is unavailable on the frontend.

§rewritten: bool

If true, the function is not implemented on the backend, but its signature is defined.

Implementations§

source§

impl FunctionAttr

source

pub fn expand(&self) -> Vec<Self>

Expands the wildcard in function arguments or return type.

source

fn generate_type_infer_fn(&self) -> Result<TokenStream2>

Generate the type infer function: fn(&[DataType]) -> Result<DataType>

source

pub fn generate_function_descriptor( &self, user_fn: &UserFunctionAttr, build_fn: bool, ) -> Result<TokenStream2>

Generate a descriptor (FuncSign) of the scalar or table function.

The types of arguments and return value should not contain wildcard.

§Arguments

build_fn: whether the user provided a function is a build function. (from the #[build_function] macro)

source

fn generate_build_scalar_function( &self, user_fn: &UserFunctionAttr, optimize_const: bool, ) -> Result<TokenStream2>

Generate a build function for the scalar function.

If optimize_const is true, the function will be optimized for constant arguments, and fallback to the general version if any argument is not constant.

source

pub fn generate_aggregate_descriptor( &self, user_fn: &AggregateFnOrImpl, build_fn: bool, ) -> Result<TokenStream2>

Generate a descriptor of the aggregate function.

The types of arguments and return value should not contain wildcard. user_fn could be either fn or impl. If build_fn is true, user_fn must be a fn that builds the aggregate function.

source

fn generate_agg_build_fn( &self, user_fn: &AggregateFnOrImpl, ) -> Result<TokenStream2>

Generate build function for aggregate function.

source

fn generate_table_function_descriptor( &self, user_fn: &UserFunctionAttr, build_fn: bool, ) -> Result<TokenStream2>

Generate a descriptor of the table function.

The types of arguments and return value should not contain wildcard.

source

fn generate_build_table_function( &self, user_fn: &UserFunctionAttr, ) -> Result<TokenStream2>

source§

impl FunctionAttr

source

pub(crate) fn ident_name(&self) -> String

Return a unique name that can be used as an identifier.

Trait Implementations§

source§

impl Clone for FunctionAttr

source§

fn clone(&self) -> FunctionAttr

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for FunctionAttr

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for FunctionAttr

source§

fn default() -> FunctionAttr

Returns the “default value” for a type. Read more
source§

impl Parse for FunctionAttr

source§

fn parse(input: ParseStream<'_>) -> Result<Self>

Parse the attribute of the function macro.

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
source§

impl<T> CloneToUninit for T
where T: Clone,

source§

unsafe fn clone_to_uninit(&self, dst: *mut T)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

impl<T> ToOwned for T
where T: Clone,

source§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

source§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.