ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
Loading...
Searching...
No Matches
Aggregator Struct Referenceabstract

Abstract interface for an incremental aggregate accumulator. More...

#include "Aggregation.h"

Inheritance diagram for Aggregator:

Public Member Functions

virtual ~Aggregator ()=default
 
virtual void add (const AggValue &x)=0
 Incorporate one input value into the running aggregate.
 
virtual AggValue finalize () const =0
 Return the final aggregate result.
 
virtual AggregationOperator op () const =0
 Return the aggregation operator this accumulator implements.
 
virtual ValueType inputType () const =0
 Return the type of the input values accepted by add().
 
virtual ValueType resultType () const
 Return the type of the value returned by finalize().
 

Detailed Description

Abstract interface for an incremental aggregate accumulator.

Each concrete subclass implements one aggregation function for one input type (e.g., SUM over integers, MAX over floats). Instances are created by makeAggregator().

Definition at line 138 of file Aggregation.h.

Constructor & Destructor Documentation

◆ ~Aggregator()

virtual Aggregator::~Aggregator ( )
virtualdefault

Member Function Documentation

◆ add()

virtual void Aggregator::add ( const AggValue x)
pure virtual

Incorporate one input value into the running aggregate.

Parameters
xInput value to add.

Implemented in NoneAgg, SumAgg< T >, MinAgg< T >, MaxAgg< T >, AndAgg, OrAgg, ChooseAgg< T >, AvgAgg< T >, and ArrayAgg< T >.

◆ finalize()

virtual AggValue Aggregator::finalize ( ) const
pure virtual

Return the final aggregate result.

Returns
The accumulated aggregate as an AggValue.

Implemented in NoneAgg, StandardAgg< T >, StandardAgg< bool >, AvgAgg< T >, and ArrayAgg< T >.

◆ inputType()

virtual ValueType Aggregator::inputType ( ) const
pure virtual

Return the type of the input values accepted by add().

Returns
The ValueType of values passed to add().

Implemented in NoneAgg, StandardAgg< T >, StandardAgg< bool >, and AvgAgg< T >.

Here is the caller graph for this function:

◆ op()

virtual AggregationOperator Aggregator::op ( ) const
pure virtual

Return the aggregation operator this accumulator implements.

Returns
The AggregationOperator enum value for this accumulator.

Implemented in NoneAgg, SumAgg< T >, MinAgg< T >, MaxAgg< T >, AndAgg, OrAgg, ChooseAgg< T >, AvgAgg< T >, and ArrayAgg< T >.

◆ resultType()

virtual ValueType Aggregator::resultType ( ) const
inlinevirtual

Return the type of the value returned by finalize().

Defaults to inputType(); override when the result type differs (e.g., AVG returns FLOAT regardless of the input type).

Returns
The ValueType of the value returned by finalize().

Reimplemented in AvgAgg< T >, and ArrayAgg< T >.

Definition at line 172 of file Aggregation.h.

Here is the call graph for this function:

The documentation for this struct was generated from the following file: