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>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait;
    fn call_table_function<'a, 'async_trait>(
        &'a self,
        input: &'a RecordBatch,
    ) -> Pin<Box<dyn Future<Output = Result<BoxStream<'a, Result<RecordBatch>>>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'a: 'async_trait;

    // Provided methods
    fn call_agg_create_state<'life0, 'async_trait>(
        &'life0 self,
    ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait { ... }
    fn call_agg_accumulate_or_retract<'life0, 'life1, 'life2, 'life3, 'async_trait>(
        &'life0 self,
        _state: &'life1 ArrayRef,
        _ops: &'life2 BooleanArray,
        _input: &'life3 RecordBatch,
    ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait,
             'life2: 'async_trait,
             'life3: 'async_trait { ... }
    fn call_agg_finish<'life0, 'life1, 'async_trait>(
        &'life0 self,
        _state: &'life1 ArrayRef,
    ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
    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>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: '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<BoxStream<'a, Result<RecordBatch>>>> + Send + 'async_trait>>
where Self: 'async_trait, 'a: 'async_trait,

Call the table function.

Provided Methods§

Source

fn call_agg_create_state<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

For aggregate function, create the initial state.

Source

fn call_agg_accumulate_or_retract<'life0, 'life1, 'life2, 'life3, 'async_trait>( &'life0 self, _state: &'life1 ArrayRef, _ops: &'life2 BooleanArray, _input: &'life3 RecordBatch, ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait, 'life2: 'async_trait, 'life3: 'async_trait,

For aggregate function, accumulate or retract the state.

Source

fn call_agg_finish<'life0, 'life1, 'async_trait>( &'life0 self, _state: &'life1 ArrayRef, ) -> Pin<Box<dyn Future<Output = Result<ArrayRef>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

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§