![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Aggregation operator and accumulator implementations. More...
#include "Aggregation.h"#include <string>#include <stdexcept>#include "utils/lsyscache.h"#include "utils/elog.h"#include "provsql_error.h"
Go to the source code of this file.
Classes | |
| struct | NoneAgg |
| Aggregator that ignores all inputs and always returns NULL. More... | |
| struct | False<... > |
| struct | StandardAgg< T > |
| Base aggregator template for scalar types (int, float, bool, string). More... | |
| struct | SumAgg< T > |
| Aggregator implementing SUM for integer or float types. More... | |
| struct | MinAgg< T > |
| Aggregator implementing MIN for integer or float types. More... | |
| struct | MaxAgg< T > |
| Aggregator implementing MAX for integer or float types. More... | |
| struct | AndAgg |
| Aggregator implementing boolean AND (returns false if any input is false). More... | |
| struct | OrAgg |
| Aggregator implementing boolean OR (returns true if any input is true). More... | |
| struct | ChooseAgg< T > |
| Aggregator implementing CHOOSE (returns the first non-NULL input). More... | |
| struct | AvgAgg< T > |
| Aggregator implementing AVG; always returns a float result. More... | |
| struct | ArrayAgg< T > |
| Aggregator implementing ARRAY_AGG; collects all non-NULL inputs into an array. More... | |
Functions | |
| AggregationOperator | getAggregationOperator (Oid oid) |
Map a PostgreSQL aggregate function OID to an AggregationOperator. | |
| std::unique_ptr< Aggregator > | makeAggregator (AggregationOperator op, ValueType t) |
Create a concrete Aggregator for the given operator and value type. | |
Aggregation operator and accumulator implementations.
Implements the two factory functions declared in Aggregation.h:
getAggregationOperator(): maps a PostgreSQL aggregate function OID (looked up by name via get_func_name()) to an AggregationOperator enum value.makeAggregator(): constructs a concrete Aggregator subclass for the given operator/type combination.Each aggregation function × value-type combination has its own Aggregator subclass defined locally in this file (e.g. SumAggregator<long>, MinAggregator<double>, ArrayAggregator<std::string>, etc.).
Definition in file Aggregation.cpp.
| AggregationOperator getAggregationOperator | ( | Oid | oid | ) |
Map a PostgreSQL aggregate function OID to an AggregationOperator.
| oid | OID of the aggregate function (e.g. F_COUNT_ANY, F_SUM_INT4). |
AggregationOperator. Definition at line 29 of file Aggregation.cpp.

| std::unique_ptr< Aggregator > makeAggregator | ( | AggregationOperator | op, |
| ValueType | t | ||
| ) |
Create a concrete Aggregator for the given operator and value type.
| op | The aggregation function to implement. |
| t | The type of input values that will be accumulated. |
Aggregator, or nullptr if the combination is not supported. Definition at line 294 of file Aggregation.cpp.
