Skip to main content

AggregateFunction

Trait AggregateFunction 

Source
pub trait AggregateFunction: Send + Sync {
    // Required methods
    fn create_accumulator(&self) -> Vec<u8> ;
    fn add(&self, accumulator: Vec<u8>, value: Vec<u8>) -> Vec<u8> ;
    fn get_result(&self, accumulator: Vec<u8>) -> Vec<u8> ;
    fn merge(&self, acc1: Vec<u8>, acc2: Vec<u8>) -> Vec<u8> ;
}
Expand description

Trait for aggregate functions.

Required Methods§

Source

fn create_accumulator(&self) -> Vec<u8>

Create initial accumulator.

Source

fn add(&self, accumulator: Vec<u8>, value: Vec<u8>) -> Vec<u8>

Add a value to the accumulator.

Source

fn get_result(&self, accumulator: Vec<u8>) -> Vec<u8>

Get the result from the accumulator.

Source

fn merge(&self, acc1: Vec<u8>, acc2: Vec<u8>) -> Vec<u8>

Merge two accumulators.

Implementors§