AggregateFunction and AggregateFunctionFactory C++ Interface

This section describes information that is specific to the C++ API. See UDAF Class Overview for general information about implementing the AggregateFunction and AggregateFunctionFactory classes.

AggregateFunction API

The API provides the following methods for extension by subclasses:

virtual void setup(ServerInterface &srvInterface, 
		const SizedColumnTypes &argTypes);
				
virtual void initAggregate(ServerInterface &srvInterface, IntermediateAggs &aggs)=0;
				
void aggregate(ServerInterface &srvInterface, BlockReader &arg_reader, 
		IntermediateAggs &aggs); 
								
virtual void combine(ServerInterface &srvInterface, IntermediateAggs &aggs_output, 
		MultipleIntermediateAggs &aggs_other)=0;
				
virtual void terminate(ServerInterface &srvInterface, BlockWriter &res_writer, 
		IntermediateAggs &aggs);
				
virtual void destroy(ServerInterface &srvInterface, const SizedColumnTypes &argTypes);
		

AggregateFunctionFactory API

The API provides the following methods for extension by subclasses:

virtual AggregateFunction * 
		createAggregateFunction ServerInterface &srvInterface)=0;
				
virtual void getPrototype(ServerInterface &srvInterface, 
		ColumnTypes &argTypes, ColumnTypes &returnType)=0;
				
virtual void getIntermediateTypes(ServerInterface &srvInterface, 
		const SizedColumnTypes &inputTypes, SizedColumnTypes &intermediateTypeMetaData)=0;
				
virtual void getReturnType(ServerInterface &srvInterface, 
		const SizedColumnTypes &argTypes, SizedColumnTypes &returnType)=0;
				
virtual void getParameterType(ServerInterface &srvInterface, 
		SizedColumnTypes &parameterTypes);