diff options
Diffstat (limited to 'src/include/nodes')
| -rw-r--r-- | src/include/nodes/execnodes.h | 6 | ||||
| -rw-r--r-- | src/include/nodes/nodes.h | 3 | ||||
| -rw-r--r-- | src/include/nodes/parsenodes.h | 4 | ||||
| -rw-r--r-- | src/include/nodes/plannodes.h | 53 | ||||
| -rw-r--r-- | src/include/nodes/relation.h | 17 |
5 files changed, 60 insertions, 23 deletions
diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index facef90894..533d296186 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: execnodes.h,v 1.75 2002/09/04 20:31:42 momjian Exp $ + * $Id: execnodes.h,v 1.76 2002/11/06 00:00:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -673,6 +673,8 @@ typedef struct AggState CommonScanState csstate; /* its first field is NodeTag */ List *aggs; /* all Aggref nodes in targetlist & quals */ int numaggs; /* length of list (could be zero!) */ + FmgrInfo *eqfunctions; /* per-grouping-field equality fns */ + HeapTuple grp_firstTuple; /* copy of first tuple of current group */ AggStatePerAgg peragg; /* per-Aggref working state */ MemoryContext tup_cxt; /* context for per-output-tuple * expressions */ @@ -691,7 +693,7 @@ typedef struct GroupState FmgrInfo *eqfunctions; /* per-field lookup data for equality fns */ bool grp_useFirstTuple; /* first tuple not processed yet */ bool grp_done; - HeapTuple grp_firstTuple; + HeapTuple grp_firstTuple; /* copy of first tuple of current group */ } GroupState; /* ---------------- diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 5320c1b10d..aad54a9c26 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: nodes.h,v 1.120 2002/10/11 04:16:44 momjian Exp $ + * $Id: nodes.h,v 1.121 2002/11/06 00:00:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -82,6 +82,7 @@ typedef enum NodeTag T_HashPath, T_TidPath, T_AppendPath, + T_ResultPath, T_PathKeyItem, T_RestrictInfo, T_JoinInfo, diff --git a/src/include/nodes/parsenodes.h b/src/include/nodes/parsenodes.h index ee0d221013..8303fe9d09 100644 --- a/src/include/nodes/parsenodes.h +++ b/src/include/nodes/parsenodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: parsenodes.h,v 1.209 2002/10/14 22:14:35 tgl Exp $ + * $Id: parsenodes.h,v 1.210 2002/11/06 00:00:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -101,7 +101,7 @@ typedef struct Query List *join_rel_list; /* list of join-relation RelOptInfos */ List *equi_key_list; /* list of lists of equijoined * PathKeyItems */ - List *query_pathkeys; /* pathkeys for query_planner()'s result */ + List *query_pathkeys; /* desired pathkeys for query_planner() */ } Query; diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 8d26fea6f0..63c8f20d80 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: plannodes.h,v 1.58 2002/09/04 20:31:44 momjian Exp $ + * $Id: plannodes.h,v 1.59 2002/11/06 00:00:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -140,17 +140,23 @@ typedef struct Plan * =============== */ -/* all plan nodes "derive" from the Plan structure by having the - Plan structure as the first field. This ensures that everything works - when nodes are cast to Plan's. (node pointers are frequently cast to Plan* - when passed around generically in the executor */ +/* + * all plan nodes "derive" from the Plan structure by having the + * Plan structure as the first field. This ensures that everything works + * when nodes are cast to Plan's. (node pointers are frequently cast to Plan* + * when passed around generically in the executor) + */ /* ---------------- * Result node - * If no outer plan, evaluate a variable-free targetlist. - * If outer plan, return tuples from outer plan that satisfy - * given quals (we can also do a level of projection) + * If outer plan, return tuples from outer plan (after a level of + * projection as shown by targetlist). + * + * If resconstantqual isn't NULL, it represents a one-time qualification + * test (i.e., one that doesn't depend on any variables from the outer plan, + * so needs to be evaluated only once). * ---------------- */ typedef struct Result @@ -318,30 +324,45 @@ typedef struct HashJoin /* --------------- * aggregate node + * + * An Agg node implements plain or grouped aggregation. For grouped + * aggregation, we can work with presorted input or unsorted input; + * the latter strategy uses an internal hashtable. + * + * Notice the lack of any direct info about the aggregate functions to be + * computed. They are found by scanning the node's tlist and quals during + * executor startup. (It is possible that there are no aggregate functions; + * this could happen if they get optimized away by constant-folding, or if + * we are using the Agg node to implement hash-based grouping.) * --------------- */ +typedef enum AggStrategy +{ + AGG_PLAIN, /* simple agg across all input rows */ + AGG_SORTED, /* grouped agg, input must be sorted */ + AGG_HASHED /* grouped agg, use internal hashtable */ +} AggStrategy; + typedef struct Agg { Plan plan; + AggStrategy aggstrategy; + int numCols; /* number of grouping columns */ + AttrNumber *grpColIdx; /* their indexes in the target list */ AggState *aggstate; } Agg; /* --------------- * group node - - * use for queries with GROUP BY specified. - * - * If tuplePerGroup is true, one tuple (with group columns only) is - * returned for each group and NULL is returned when there are no more - * groups. Otherwise, all the tuples of a group are returned with a - * NULL returned at the end of each group. (see nodeGroup.c for details) + * Used for queries with GROUP BY (but no aggregates) specified. + * The input must be presorted according to the grouping columns. * --------------- */ typedef struct Group { Plan plan; - bool tuplePerGroup; /* what tuples to return (see above) */ - int numCols; /* number of group columns */ - AttrNumber *grpColIdx; /* indexes into the target list */ + int numCols; /* number of grouping columns */ + AttrNumber *grpColIdx; /* their indexes in the target list */ GroupState *grpstate; } Group; diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index 071addbc1b..480fd9630b 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -1,13 +1,13 @@ /*------------------------------------------------------------------------- * * relation.h - * Definitions for internal planner nodes. + * Definitions for planner's internal data structures. * * * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: relation.h,v 1.67 2002/09/04 20:31:44 momjian Exp $ + * $Id: relation.h,v 1.68 2002/11/06 00:00:44 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -403,6 +403,19 @@ typedef struct AppendPath } AppendPath; /* + * ResultPath represents use of a Result plan node, either to compute a + * variable-free targetlist or to gate execution of a subplan with a + * one-time (variable-free) qual condition. Note that in the former case + * path.parent will be NULL; in the latter case it is copied from the subpath. + */ +typedef struct ResultPath +{ + Path path; + Path *subpath; + List *constantqual; +} ResultPath; + +/* * All join-type paths share these fields. */ |
