![]() |
ProvSQL C/C++ API
Adding support for provenance and uncertainty management to PostgreSQL databases
|
Typed aggregation value, operator, and aggregator abstractions. More...
#include "postgres.h"#include <variant>#include <string>#include <vector>#include <cassert>#include <memory>

Go to the source code of this file.
Classes | |
| struct | AggValue |
| A dynamically-typed aggregate value. More... | |
| struct | Aggregator |
| Abstract interface for an incremental aggregate accumulator. More... | |
Enumerations | |
| enum class | ComparisonOperator { EQ , NE , LE , LT , GE , GT } |
SQL comparison operators used in gate_cmp circuit gates. More... | |
| enum class | AggregationOperator { COUNT , SUM , MIN , MAX , AVG , AND , OR , CHOOSE , ARRAY_AGG , NONE } |
| SQL aggregation functions tracked by ProvSQL. More... | |
| enum class | ValueType { INT , FLOAT , BOOLEAN , STRING , ARRAY_INT , ARRAY_FLOAT , ARRAY_BOOLEAN , ARRAY_STRING , NONE } |
| Runtime type tag for aggregate values. 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. | |
Typed aggregation value, operator, and aggregator abstractions.
This header provides the type system used by ProvSQL's aggregate provenance evaluation:
ComparisonOperator: the six standard SQL comparison operators, used by gate_cmp gates in the circuit.AggregationOperator: the SQL aggregation functions that ProvSQL tracks provenance for (COUNT, SUM, MIN, MAX, AVG, AND, OR, …).ValueType: the runtime type tag for aggregate values.AggValue: a tagged union holding one aggregate value of any supported type, built on std::variant.Aggregator: an abstract interface for stateful incremental accumulators, one per aggregation function/type combination.The free functions getAggregationOperator() and makeAggregator() map PostgreSQL OIDs and operator/type pairs to the corresponding C++ objects.
Definition in file Aggregation.h.
|
strong |
SQL aggregation functions tracked by ProvSQL.
| Enumerator | |
|---|---|
| COUNT | COUNT(*) or COUNT(expr) → integer. |
| SUM | SUM → integer or float. |
| MIN | MIN → input type. |
| MAX | MAX → input type. |
| AVG | AVG → float. |
| AND | Boolean AND aggregate. |
| OR | Boolean OR aggregate. |
| CHOOSE | Arbitrary selection (pick one element) |
| ARRAY_AGG | Array aggregation. |
| NONE | No aggregation (returns NULL) |
Definition at line 50 of file Aggregation.h.
|
strong |
SQL comparison operators used in gate_cmp circuit gates.
| Enumerator | |
|---|---|
| EQ | Equal (=) |
| NE | Not equal (<>) |
| LE | Less than or equal (<=) |
| LT | Less than (<) |
| GE | Greater than or equal (>=) |
| GT | Greater than (>) |
Definition at line 38 of file Aggregation.h.
|
strong |
Runtime type tag for aggregate values.
Definition at line 66 of file Aggregation.h.
| 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.
