C++ SDK Documentation  9.0
Vertica::AggregateFunction Class Referenceabstract

Interface for User-Defined Aggregate Function (UDAF). A UDAF operates on one column of data and returns one column of data. More...

Inheritance diagram for Vertica::AggregateFunction:
Inheritance graph
Collaboration diagram for Vertica::AggregateFunction:
Collaboration graph

Public Member Functions

virtual void aggregateArrs (ServerInterface &srvInterface, void **dstTuples, int doff, const void *arr, int stride, const void *rcounts, int rcstride, int count, IntermediateAggs &intAggs, std::vector< int > &intOffsets, BlockReader &arg_reader)=0
 
virtual void combine (ServerInterface &srvInterface, IntermediateAggs &aggs_output, MultipleIntermediateAggs &aggs_other)=0
 
virtual void destroy (ServerInterface &srvInterface, const SizedColumnTypes &argTypes)
 
virtual void destroy (ServerInterface &srvInterface, const SizedColumnTypes &argTypes, SessionParamWriterMap &udSessionParams)
 
virtual void initAggregate (ServerInterface &srvInterface, IntermediateAggs &aggs)=0
 
virtual void setup (ServerInterface &srvInterface, const SizedColumnTypes &argTypes)
 
virtual void terminate (ServerInterface &srvInterface, BlockWriter &res_writer, IntermediateAggs &aggs)
 
virtual void terminate (ServerInterface &srvInterface, BlockWriter &res_writer, IntermediateAggs &aggs, SessionParamWriterMap &udSessionParams)
 

Static Public Member Functions

static void updateCols (BlockReader &arg_reader, char *arg, int count, IntermediateAggs &intAggs, char *aggPtr, std::vector< int > &intOffsets)
 

Detailed Description

Interface for User-Defined Aggregate Function (UDAF). A UDAF operates on one column of data and returns one column of data.

An AggregateFunction must have an associated AggregateFunctionFactory.

Member Function Documentation

virtual void Vertica::AggregateFunction::aggregateArrs ( ServerInterface srvInterface,
void **  dstTuples,
int  doff,
const void *  arr,
int  stride,
const void *  rcounts,
int  rcstride,
int  count,
IntermediateAggs intAggs,
std::vector< int > &  intOffsets,
BlockReader arg_reader 
)
pure virtual

Called by the server to perform aggregation on multiple blocks of data

Note
User should not explicity implement this function. It is implemented by calling the InlineAggregate() macro. User should follow the convention of implementing void aggregate(ServerInterface &srvInterface, BlockReader &arg_reader, IntermediateAggs &aggs) along with initAggregate, combine, and terminate. For references on what a fully implemented Aggregate Function looks like, check the examples in the example folder.

which the inlined aggregateArrs implemention will invoke

virtual void Vertica::AggregateFunction::combine ( ServerInterface srvInterface,
IntermediateAggs aggs_output,
MultipleIntermediateAggs aggs_other 
)
pure virtual

Called when intermediate aggregates need to be combined with each other

virtual void Vertica::UDXObject::destroy ( ServerInterface srvInterface,
const SizedColumnTypes argTypes 
)
inlinevirtualinherited

Perform per instance destruction. This function may throw errors

virtual void Vertica::UDXObject::destroy ( ServerInterface srvInterface,
const SizedColumnTypes argTypes,
SessionParamWriterMap udSessionParams 
)
inlinevirtualinherited

Perform per instance destruction and write session parameters to be used by UDxs that are invoked after this one returns. This function may throw errors

virtual void Vertica::AggregateFunction::initAggregate ( ServerInterface srvInterface,
IntermediateAggs aggs 
)
pure virtual

Called by the server to set the starting values of the Intermediate aggregates.

Note
This can be called multiple times on multiple machines, so starting values should be idempotent.
virtual void Vertica::UDXObject::setup ( ServerInterface srvInterface,
const SizedColumnTypes argTypes 
)
inlinevirtualinherited

Perform per instance initialization. This function may throw errors.

virtual void Vertica::AggregateFunction::terminate ( ServerInterface srvInterface,
BlockWriter res_writer,
IntermediateAggs aggs 
)
inlinevirtual

Called by the server to get the output to the aggregate function

virtual void Vertica::AggregateFunction::terminate ( ServerInterface srvInterface,
BlockWriter res_writer,
IntermediateAggs aggs,
SessionParamWriterMap udSessionParams 
)
inlinevirtual

Called by the server to get the output to the aggregate function

void Vertica::AggregateFunction::updateCols ( BlockReader arg_reader,
char *  arg,
int  count,
IntermediateAggs intAggs,
char *  aggPtr,
std::vector< int > &  intOffsets 
)
static

Helper function for aggregateArrs.

Note
User should not call this function.