Skip to content

Commit cfc7103

Browse files
committed
Adjust TupleHashTables to use MinimalTuple format for contained tuples.
1 parent 1589733 commit cfc7103

File tree

4 files changed

+22
-24
lines changed

4 files changed

+22
-24
lines changed

src/backend/executor/execGrouping.c

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.18 2006/03/05 15:58:25 momjian Exp $
11+
* $PostgreSQL: pgsql/src/backend/executor/execGrouping.c,v 1.19 2006/06/28 17:05:49 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -389,7 +389,7 @@ LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot,
389389

390390
/* Copy the first tuple into the table context */
391391
MemoryContextSwitchTo(hashtable->tablecxt);
392-
entry->firstTuple = ExecCopySlotTuple(slot);
392+
entry->firstTuple = ExecCopySlotMinimalTuple(slot);
393393

394394
*isnew = true;
395395
}
@@ -405,23 +405,23 @@ LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot,
405405
/*
406406
* Compute the hash value for a tuple
407407
*
408-
* The passed-in key is a pointer to TupleHashEntryData. In an actual
409-
* hash table entry, the firstTuple field therein points to a physical
410-
* tuple. LookupTupleHashEntry sets up a dummy TupleHashEntryData with
411-
* a NULL firstTuple field --- that cues us to look at the inputslot instead.
412-
* This convention avoids the need to materialize virtual input tuples
413-
* unless they actually need to get copied into the table.
408+
* The passed-in key is a pointer to TupleHashEntryData. In an actual hash
409+
* table entry, the firstTuple field points to a tuple (in MinimalTuple
410+
* format). LookupTupleHashEntry sets up a dummy TupleHashEntryData with a
411+
* NULL firstTuple field --- that cues us to look at the inputslot instead.
412+
* This convention avoids the need to materialize virtual input tuples unless
413+
* they actually need to get copied into the table.
414414
*
415415
* CurTupleHashTable must be set before calling this, since dynahash.c
416416
* doesn't provide any API that would let us get at the hashtable otherwise.
417417
*
418418
* Also, the caller must select an appropriate memory context for running
419-
* the hash functions. (dynahash.c doesn't change CurrentMemoryContext.)
419+
* the hash functions. (dynahash.c doesn't change CurrentMemoryContext.)
420420
*/
421421
static uint32
422422
TupleHashTableHash(const void *key, Size keysize)
423423
{
424-
HeapTuple tuple = ((const TupleHashEntryData *) key)->firstTuple;
424+
MinimalTuple tuple = ((const TupleHashEntryData *) key)->firstTuple;
425425
TupleTableSlot *slot;
426426
TupleHashTable hashtable = CurTupleHashTable;
427427
int numCols = hashtable->numCols;
@@ -439,7 +439,7 @@ TupleHashTableHash(const void *key, Size keysize)
439439
/* Process a tuple already stored in the table */
440440
/* (this case never actually occurs in current dynahash.c code) */
441441
slot = hashtable->tableslot;
442-
ExecStoreTuple(tuple, slot, InvalidBuffer, false);
442+
ExecStoreMinimalTuple(tuple, slot, false);
443443
}
444444

445445
for (i = 0; i < numCols; i++)
@@ -480,10 +480,10 @@ TupleHashTableHash(const void *key, Size keysize)
480480
static int
481481
TupleHashTableMatch(const void *key1, const void *key2, Size keysize)
482482
{
483-
HeapTuple tuple1 = ((const TupleHashEntryData *) key1)->firstTuple;
483+
MinimalTuple tuple1 = ((const TupleHashEntryData *) key1)->firstTuple;
484484

485485
#ifdef USE_ASSERT_CHECKING
486-
HeapTuple tuple2 = ((const TupleHashEntryData *) key2)->firstTuple;
486+
MinimalTuple tuple2 = ((const TupleHashEntryData *) key2)->firstTuple;
487487
#endif
488488
TupleTableSlot *slot1;
489489
TupleTableSlot *slot2;
@@ -497,7 +497,7 @@ TupleHashTableMatch(const void *key1, const void *key2, Size keysize)
497497
*/
498498
Assert(tuple1 != NULL);
499499
slot1 = hashtable->tableslot;
500-
ExecStoreTuple(tuple1, slot1, InvalidBuffer, false);
500+
ExecStoreMinimalTuple(tuple1, slot1, false);
501501
Assert(tuple2 == NULL);
502502
slot2 = hashtable->inputslot;
503503

src/backend/executor/nodeAgg.c

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
* Portions Copyright (c) 1994, Regents of the University of California
6262
*
6363
* IDENTIFICATION
64-
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.140 2006/06/21 18:39:42 tgl Exp $
64+
* $PostgreSQL: pgsql/src/backend/executor/nodeAgg.c,v 1.141 2006/06/28 17:05:49 tgl Exp $
6565
*
6666
*-------------------------------------------------------------------------
6767
*/
@@ -957,10 +957,9 @@ agg_retrieve_hash_table(AggState *aggstate)
957957
* Store the copied first input tuple in the tuple table slot reserved
958958
* for it, so that it can be used in ExecProject.
959959
*/
960-
ExecStoreTuple(entry->shared.firstTuple,
961-
firstSlot,
962-
InvalidBuffer,
963-
false);
960+
ExecStoreMinimalTuple(entry->shared.firstTuple,
961+
firstSlot,
962+
false);
964963

965964
pergroup = entry->pergroup;
966965

src/backend/executor/nodeSubplan.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1994, Regents of the University of California
88
*
99
* IDENTIFICATION
10-
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.75 2006/06/16 18:42:22 tgl Exp $
10+
* $PostgreSQL: pgsql/src/backend/executor/nodeSubplan.c,v 1.76 2006/06/28 17:05:49 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -572,8 +572,7 @@ findPartialMatch(TupleHashTable hashtable, TupleTableSlot *slot)
572572
ResetTupleHashIterator(hashtable, &hashiter);
573573
while ((entry = ScanTupleHashTable(&hashiter)) != NULL)
574574
{
575-
ExecStoreTuple(entry->firstTuple, hashtable->tableslot,
576-
InvalidBuffer, false);
575+
ExecStoreMinimalTuple(entry->firstTuple, hashtable->tableslot, false);
577576
if (!execTuplesUnequal(hashtable->tableslot, slot,
578577
numCols, keyColIdx,
579578
hashtable->eqfunctions,

src/include/nodes/execnodes.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.150 2006/04/30 18:30:40 tgl Exp $
10+
* $PostgreSQL: pgsql/src/include/nodes/execnodes.h,v 1.151 2006/06/28 17:05:49 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -367,7 +367,7 @@ typedef struct TupleHashTableData *TupleHashTable;
367367
typedef struct TupleHashEntryData
368368
{
369369
/* firstTuple must be the first field in this struct! */
370-
HeapTuple firstTuple; /* copy of first tuple in this group */
370+
MinimalTuple firstTuple; /* copy of first tuple in this group */
371371
/* there may be additional data beyond the end of this struct */
372372
} TupleHashEntryData; /* VARIABLE LENGTH STRUCT */
373373

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy