risingwave_frontend::catalog::schema_catalog

Trait UdfImpl

source
pub trait UdfImpl:
    Debug
    + Send
    + Sync {
    // Required methods
    fn call<'life0, 'life1, 'async_trait>(
        &'life0 self,
        input: &'life1 RecordBatch,
    ) -> Pin<Box<dyn Future<Output = Result<RecordBatch, Error>> + Send + 'async_trait>>
       where 'life0: 'async_trait,
             'life1: 'async_trait,
             Self: 'async_trait;
    fn call_table_function<'a, 'async_trait>(
        &'a self,
        input: &'a RecordBatch,
    ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<RecordBatch, Error>> + Send + 'a>>, Error>> + Send + 'async_trait>>
       where 'a: 'async_trait,
             Self: 'async_trait;

    // Provided methods
    fn call_agg_create_state(&self) -> Result<Arc<dyn Array>, Error> { ... }
    fn call_agg_accumulate_or_retract(
        &self,
        _state: &Arc<dyn Array>,
        _ops: &BooleanArray,
        _input: &RecordBatch,
    ) -> Result<Arc<dyn Array>, Error> { ... }
    fn call_agg_finish(
        &self,
        _state: &Arc<dyn Array>,
    ) -> Result<Arc<dyn Array>, Error> { ... }
    fn is_legacy(&self) -> bool { ... }
    fn memory_usage(&self) -> usize { ... }
}
Expand description

UDF implementation.

Required Methods§

source

fn call<'life0, 'life1, 'async_trait>( &'life0 self, input: &'life1 RecordBatch, ) -> Pin<Box<dyn Future<Output = Result<RecordBatch, Error>> + Send + 'async_trait>>
where 'life0: 'async_trait, 'life1: 'async_trait, Self: 'async_trait,

Call the scalar function.

source

fn call_table_function<'a, 'async_trait>( &'a self, input: &'a RecordBatch, ) -> Pin<Box<dyn Future<Output = Result<Pin<Box<dyn Stream<Item = Result<RecordBatch, Error>> + Send + 'a>>, Error>> + Send + 'async_trait>>
where 'a: 'async_trait, Self: 'async_trait,

Call the table function.

Provided Methods§

source

fn call_agg_create_state(&self) -> Result<Arc<dyn Array>, Error>

For aggregate function, create the initial state.

source

fn call_agg_accumulate_or_retract( &self, _state: &Arc<dyn Array>, _ops: &BooleanArray, _input: &RecordBatch, ) -> Result<Arc<dyn Array>, Error>

For aggregate function, accumulate or retract the state.

source

fn call_agg_finish( &self, _state: &Arc<dyn Array>, ) -> Result<Arc<dyn Array>, Error>

For aggregate function, get aggregate result from the state.

source

fn is_legacy(&self) -> bool

Whether the UDF talks in legacy mode.

If true, decimal and jsonb types are mapped to Arrow LargeBinary and LargeUtf8 types. Otherwise, they are mapped to Arrow extension types. See https://github.com/risingwavelabs/arrow-udf/tree/main#extension-types.

source

fn memory_usage(&self) -> usize

Return the memory size consumed by UDF runtime in bytes.

If not available, return 0.

Implementors§