diff options
| author | Robert Haas | 2016-01-20 18:46:50 +0000 |
|---|---|---|
| committer | Robert Haas | 2016-01-20 18:46:50 +0000 |
| commit | a7de3dc5c346e07e0439275982569996e645b3c2 (patch) | |
| tree | 9d47c8729c497aeff82b196ddf5f85f478c2a21d /src/include/nodes | |
| parent | c8642d909fdd57c36dd71e0b0bb4071523324794 (diff) | |
Support multi-stage aggregation.
Aggregate nodes now have two new modes: a "partial" mode where they
output the unfinalized transition state, and a "finalize" mode where
they accept unfinalized transition states rather than individual
values as input.
These new modes are not used anywhere yet, but they will be necessary
for parallel aggregation. The infrastructure also figures to be
useful for cases where we want to aggregate local data and remote
data via the FDW interface, and want to bring back partial aggregates
from the remote side that can then be combined with locally generated
partial aggregates to produce the final value. It may also be useful
even when neither FDWs nor parallelism are in play, as explained in
the comments in nodeAgg.c.
David Rowley and Simon Riggs, reviewed by KaiGai Kohei, Heikki
Linnakangas, Haribabu Kommi, and me.
Diffstat (limited to 'src/include/nodes')
| -rw-r--r-- | src/include/nodes/execnodes.h | 2 | ||||
| -rw-r--r-- | src/include/nodes/plannodes.h | 2 |
2 files changed, 4 insertions, 0 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index bfa51256816..07cd20ac504 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -1851,6 +1851,8 @@ typedef struct AggState AggStatePerTrans curpertrans; /* currently active trans state */ bool input_done; /* indicates end of input */ bool agg_done; /* indicates completion of Agg scan */ + bool combineStates; /* input tuples contain transition states */ + bool finalizeAggs; /* should we call the finalfn on agg states? */ int projected_set; /* The last projected grouping set */ int current_set; /* The current grouping set being evaluated */ Bitmapset *grouped_cols; /* grouped cols in current projection */ diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index c92579b2b9e..e823c830115 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -726,6 +726,8 @@ typedef struct Agg AggStrategy aggstrategy; int numCols; /* number of grouping columns */ AttrNumber *grpColIdx; /* their indexes in the target list */ + bool combineStates; /* input tuples contain transition states */ + bool finalizeAggs; /* should we call the finalfn on agg states? */ Oid *grpOperators; /* equality operators to compare with */ long numGroups; /* estimated number of groups in input */ List *groupingSets; /* grouping sets to use */ |
