aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeWindowAgg.c
diff options
context:
space:
mode:
authorAndres Freund <andres@anarazel.de>2018-02-15 22:39:18 -0800
committerAndres Freund <andres@anarazel.de>2018-02-15 22:39:18 -0800
commit2a41507dab0f293ff241fe8ae326065998668af8 (patch)
tree30fe1118750ea9c2805bd38a7485390f4d381715 /src/backend/executor/nodeWindowAgg.c
parent773aec7aa98abd38d6d9435913bb8e14e392c274 (diff)
downloadpostgresql-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/nodeWindowAgg.c')
-rw-r--r--src/backend/executor/nodeWindowAgg.c38
1 files changed, 13 insertions, 25 deletions
diff --git a/src/backend/executor/nodeWindowAgg.c b/src/backend/executor/nodeWindowAgg.c
index 1c807a82922..f6412576f40 100644
--- a/src/backend/executor/nodeWindowAgg.c
+++ b/src/backend/executor/nodeWindowAgg.c
@@ -1272,13 +1272,12 @@ spool_tuples(WindowAggState *winstate, int64 pos)
if (node->partNumCols > 0)
{
- ExprContext *econtext = winstate->tmpcontext;
-
- econtext->ecxt_innertuple = winstate->first_part_slot;
- econtext->ecxt_outertuple = outerslot;
-
/* Check if this tuple still belongs to the current partition */
- if (!ExecQualAndReset(winstate->partEqfunction, econtext))
+ if (!execTuplesMatch(winstate->first_part_slot,
+ outerslot,
+ node->partNumCols, node->partColIdx,
+ winstate->partEqfunctions,
+ winstate->tmpcontext->ecxt_per_tuple_memory))
{
/*
* end of partition; copy the tuple for the next cycle.
@@ -2246,7 +2245,6 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
wfuncno,
numaggs,
aggno;
- TupleDesc scanDesc;
ListCell *l;
/* check for unsupported flags */
@@ -2329,7 +2327,6 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
* store in the tuplestore and use in all our working slots).
*/
ExecAssignScanTypeFromOuterPlan(&winstate->ss);
- scanDesc = winstate->ss.ss_ScanTupleSlot->tts_tupleDescriptor;
ExecSetSlotDescriptor(winstate->first_part_slot,
winstate->ss.ss_ScanTupleSlot->tts_tupleDescriptor);
@@ -2354,20 +2351,11 @@ ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags)
/* Set up data for comparing tuples */
if (node->partNumCols > 0)
- winstate->partEqfunction =
- execTuplesMatchPrepare(scanDesc,
- node->partNumCols,
- node->partColIdx,
- node->partOperators,
- &winstate->ss.ps);
-
+ winstate->partEqfunctions = execTuplesMatchPrepare(node->partNumCols,
+ node->partOperators);
if (node->ordNumCols > 0)
- winstate->ordEqfunction =
- execTuplesMatchPrepare(scanDesc,
- node->ordNumCols,
- node->ordColIdx,
- node->ordOperators,
- &winstate->ss.ps);
+ winstate->ordEqfunctions = execTuplesMatchPrepare(node->ordNumCols,
+ node->ordOperators);
/*
* WindowAgg nodes use aggvalues and aggnulls as well as Agg nodes.
@@ -2891,15 +2879,15 @@ are_peers(WindowAggState *winstate, TupleTableSlot *slot1,
TupleTableSlot *slot2)
{
WindowAgg *node = (WindowAgg *) winstate->ss.ps.plan;
- ExprContext *econtext = winstate->tmpcontext;
/* If no ORDER BY, all rows are peers with each other */
if (node->ordNumCols == 0)
return true;
- econtext->ecxt_outertuple = slot1;
- econtext->ecxt_innertuple = slot2;
- return ExecQualAndReset(winstate->ordEqfunction, econtext);
+ return execTuplesMatch(slot1, slot2,
+ node->ordNumCols, node->ordColIdx,
+ winstate->ordEqfunctions,
+ winstate->tmpcontext->ecxt_per_tuple_memory);
}
/*