aboutsummaryrefslogtreecommitdiff
path: root/src/backend/nodes/readfuncs.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2002-11-06 00:00:45 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2002-11-06 00:00:45 +0000
commitf6dba10e623fa575c8446f854aa63c97d4fedea3 (patch)
tree2c5eb86c8e2961c90b524b49f25e3c25efa6eee2 /src/backend/nodes/readfuncs.c
parenta8c18b980e1e00fe08ac02562f81e3e64d4e9fd4 (diff)
downloadpostgresql-f6dba10e623fa575c8446f854aa63c97d4fedea3.tar.gz
postgresql-f6dba10e623fa575c8446f854aa63c97d4fedea3.zip
First phase of implementing hash-based grouping/aggregation. An AGG plan
node now does its own grouping of the input rows, and has no need for a preceding GROUP node in the plan pipeline. This allows elimination of the misnamed tuplePerGroup option for GROUP, and actually saves more code in nodeGroup.c than it costs in nodeAgg.c, as well as being presumably faster. Restructure the API of query_planner so that we do not commit to using a sorted or unsorted plan in query_planner; instead grouping_planner makes the decision. (Right now it isn't any smarter than query_planner was, but that will change as soon as it has the option to select a hash- based aggregation step.) Despite all the hackery, no initdb needed since only in-memory node types changed.
Diffstat (limited to 'src/backend/nodes/readfuncs.c')
-rw-r--r--src/backend/nodes/readfuncs.c56
1 files changed, 42 insertions, 14 deletions
diff --git a/src/backend/nodes/readfuncs.c b/src/backend/nodes/readfuncs.c
index 33e28413439..568bf8ee1e4 100644
--- a/src/backend/nodes/readfuncs.c
+++ b/src/backend/nodes/readfuncs.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.135 2002/10/14 22:14:34 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/nodes/readfuncs.c,v 1.136 2002/11/06 00:00:44 tgl Exp $
*
* NOTES
* Most of the read functions for plan nodes are tested. (In fact, they
@@ -696,17 +696,6 @@ _readSort(void)
return local_node;
}
-static Agg *
-_readAgg(void)
-{
- Agg *local_node;
-
- local_node = makeNode(Agg);
- _getPlan((Plan *) local_node);
-
- return local_node;
-}
-
/* ----------------
* _readHash
*
@@ -1881,6 +1870,45 @@ _readAppendPath(void)
}
/* ----------------
+ * _readResultPath
+ *
+ * ResultPath is a subclass of Path.
+ * ----------------
+ */
+static ResultPath *
+_readResultPath(void)
+{
+ ResultPath *local_node;
+ char *token;
+ int length;
+
+ local_node = makeNode(ResultPath);
+
+ token = pg_strtok(&length); /* get :pathtype */
+ token = pg_strtok(&length); /* now read it */
+ local_node->path.pathtype = atoi(token);
+
+ token = pg_strtok(&length); /* get :startup_cost */
+ token = pg_strtok(&length); /* now read it */
+ local_node->path.startup_cost = (Cost) atof(token);
+
+ token = pg_strtok(&length); /* get :total_cost */
+ token = pg_strtok(&length); /* now read it */
+ local_node->path.total_cost = (Cost) atof(token);
+
+ token = pg_strtok(&length); /* get :pathkeys */
+ local_node->path.pathkeys = nodeRead(true); /* now read it */
+
+ token = pg_strtok(&length); /* get :subpath */
+ local_node->subpath = nodeRead(true); /* now read it */
+
+ token = pg_strtok(&length); /* get :constantqual */
+ local_node->constantqual = nodeRead(true); /* now read it */
+
+ return local_node;
+}
+
+/* ----------------
* _readNestPath
*
* NestPath is a subclass of Path
@@ -2196,8 +2224,6 @@ parsePlanString(void)
return_value = _readFromExpr();
else if (length == 8 && strncmp(token, "JOINEXPR", length) == 0)
return_value = _readJoinExpr();
- else if (length == 3 && strncmp(token, "AGG", length) == 0)
- return_value = _readAgg();
else if (length == 4 && strncmp(token, "HASH", length) == 0)
return_value = _readHash();
else if (length == 6 && strncmp(token, "RESDOM", length) == 0)
@@ -2240,6 +2266,8 @@ parsePlanString(void)
return_value = _readTidPath();
else if (length == 10 && strncmp(token, "APPENDPATH", length) == 0)
return_value = _readAppendPath();
+ else if (length == 10 && strncmp(token, "RESULTPATH", length) == 0)
+ return_value = _readResultPath();
else if (length == 8 && strncmp(token, "NESTPATH", length) == 0)
return_value = _readNestPath();
else if (length == 9 && strncmp(token, "MERGEPATH", length) == 0)