diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-26 21:21:15 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 1999-09-26 21:21:15 +0000 |
commit | be09bc9ff2e49f0d303bd4f26ce4c9de631b14bd (patch) | |
tree | 2b5c2d41ce4ab211b8b1af90d92e4befb2dd066c /src/include/nodes/execnodes.h | |
parent | 40f65241614deac2dda82c13e7228d132ee73153 (diff) |
Modify nodeAgg.c so that no rows are returned for a GROUP BY
with no input rows, per pghackers discussions around 7/22/99. Clean up
a bunch of ugly coding while at it; remove redundant re-lookup of
aggregate info at start of each new GROUP. Arrange to pfree intermediate
values when they are pass-by-ref types, so that aggregates on pass-by-ref
types no longer eat memory. This takes care of a couple of TODO items...
Diffstat (limited to 'src/include/nodes/execnodes.h')
-rw-r--r-- | src/include/nodes/execnodes.h | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 3263e500f2c..092fa57acb1 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -6,7 +6,7 @@ * * Copyright (c) 1994, Regents of the University of California * - * $Id: execnodes.h,v 1.35 1999/09/24 00:25:22 tgl Exp $ + * $Id: execnodes.h,v 1.36 1999/09/26 21:21:04 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -88,8 +88,8 @@ typedef struct ExprContext ParamListInfo ecxt_param_list_info; ParamExecData *ecxt_param_exec_vals; /* this is for subselects */ List *ecxt_range_table; - Datum *ecxt_values; /* precomputed values for aggreg */ - char *ecxt_nulls; /* null flags for aggreg values */ + Datum *ecxt_aggvalues; /* precomputed values for Aggref nodes */ + bool *ecxt_aggnulls; /* null flags for Aggref nodes */ } ExprContext; /* ---------------- @@ -565,14 +565,20 @@ typedef struct MaterialState /* --------------------- * AggregateState information * - * done indicated whether aggregate has been materialized + * Note: the associated ExprContext contains ecxt_aggvalues and ecxt_aggnulls + * arrays, which hold the computed agg values for the current input group + * during evaluation of an Agg node's output tuple(s). * ------------------------- */ +typedef struct AggStatePerAggData *AggStatePerAgg; /* private in nodeAgg.c */ + typedef struct AggState { CommonScanState csstate; /* its first field is NodeTag */ List *aggs; /* all Aggref nodes in targetlist & quals */ - bool agg_done; + int numaggs; /* length of list (could be zero!) */ + AggStatePerAgg peragg; /* per-Aggref working state */ + bool agg_done; /* indicates completion of Agg scan */ } AggState; /* --------------------- |