diff options
author | Andres Freund <andres@anarazel.de> | 2018-02-15 22:39:18 -0800 |
---|---|---|
committer | Andres Freund <andres@anarazel.de> | 2018-02-15 22:39:18 -0800 |
commit | 2a41507dab0f293ff241fe8ae326065998668af8 (patch) | |
tree | 30fe1118750ea9c2805bd38a7485390f4d381715 /src/backend/executor/nodeGroup.c | |
parent | 773aec7aa98abd38d6d9435913bb8e14e392c274 (diff) | |
download | postgresql-2a41507dab0f293ff241fe8ae326065998668af8.tar.gz postgresql-2a41507dab0f293ff241fe8ae326065998668af8.zip |
Revert "Do execGrouping.c via expression eval machinery."
This reverts commit 773aec7aa98abd38d6d9435913bb8e14e392c274.
There's an unresolved issue in the reverted commit: It only creates
one comparator function, but in for the nodeSubplan.c case we need
more (c.f. FindTupleHashEntry vs LookupTupleHashEntry calls in
nodeSubplan.c).
This isn't too difficult to fix, but it's not entirely trivial
either. The fact that the issue only causes breakage on 32bit systems
shows that the current test coverage isn't that great. To avoid
turning half the buildfarm red till those two issues are addressed,
revert.
Diffstat (limited to 'src/backend/executor/nodeGroup.c')
-rw-r--r-- | src/backend/executor/nodeGroup.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/src/backend/executor/nodeGroup.c b/src/backend/executor/nodeGroup.c index 8f7bf459efe..f1cdbaa4e67 100644 --- a/src/backend/executor/nodeGroup.c +++ b/src/backend/executor/nodeGroup.c @@ -25,7 +25,6 @@ #include "executor/executor.h" #include "executor/nodeGroup.h" #include "miscadmin.h" -#include "utils/memutils.h" /* @@ -38,6 +37,8 @@ ExecGroup(PlanState *pstate) { GroupState *node = castNode(GroupState, pstate); ExprContext *econtext; + int numCols; + AttrNumber *grpColIdx; TupleTableSlot *firsttupleslot; TupleTableSlot *outerslot; @@ -49,6 +50,8 @@ ExecGroup(PlanState *pstate) if (node->grp_done) return NULL; econtext = node->ss.ps.ps_ExprContext; + numCols = ((Group *) node->ss.ps.plan)->numCols; + grpColIdx = ((Group *) node->ss.ps.plan)->grpColIdx; /* * The ScanTupleSlot holds the (copied) first tuple of each group. @@ -56,7 +59,7 @@ ExecGroup(PlanState *pstate) firsttupleslot = node->ss.ss_ScanTupleSlot; /* - * We need not call ResetExprContext here because ExecQualAndReset() will + * We need not call ResetExprContext here because execTuplesMatch will * reset the per-tuple memory context once per input tuple. */ @@ -121,9 +124,10 @@ ExecGroup(PlanState *pstate) * Compare with first tuple and see if this tuple is of the same * group. If so, ignore it and keep scanning. */ - econtext->ecxt_innertuple = firsttupleslot; - econtext->ecxt_outertuple = outerslot; - if (!ExecQualAndReset(node->eqfunction, econtext)) + if (!execTuplesMatch(firsttupleslot, outerslot, + numCols, grpColIdx, + node->eqfunctions, + econtext->ecxt_per_tuple_memory)) break; } @@ -162,7 +166,6 @@ GroupState * ExecInitGroup(Group *node, EState *estate, int eflags) { GroupState *grpstate; - AttrNumber *grpColIdx = grpColIdx = node->grpColIdx; /* check for unsupported flags */ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK))); @@ -212,12 +215,9 @@ ExecInitGroup(Group *node, EState *estate, int eflags) /* * Precompute fmgr lookup data for inner loop */ - grpstate->eqfunction = - execTuplesMatchPrepare(ExecGetResultType(outerPlanState(grpstate)), - node->numCols, - grpColIdx, - node->grpOperators, - &grpstate->ss.ps); + grpstate->eqfunctions = + execTuplesMatchPrepare(node->numCols, + node->grpOperators); return grpstate; } |