|
20 | 20 | #include "miscadmin.h" |
21 | 21 | #include "utils/lsyscache.h" |
22 | 22 |
|
23 | | -struct TupleHashEntryData |
24 | | -{ |
25 | | - MinimalTuple firstTuple; /* copy of first tuple in this group */ |
26 | | - uint32 status; /* hash status */ |
27 | | - uint32 hash; /* hash value (cached) */ |
28 | | -}; |
29 | | - |
30 | 23 | static int TupleHashTableMatch(struct tuplehash_hash *tb, const MinimalTuple tuple1, const MinimalTuple tuple2); |
31 | 24 | static inline uint32 TupleHashTableHash_internal(struct tuplehash_hash *tb, |
32 | 25 | const MinimalTuple tuple); |
@@ -203,7 +196,6 @@ BuildTupleHashTable(PlanState *parent, |
203 | 196 | hashtable->tab_collations = collations; |
204 | 197 | hashtable->tablecxt = tablecxt; |
205 | 198 | hashtable->tempcxt = tempcxt; |
206 | | - hashtable->additionalsize = additionalsize; |
207 | 199 | hashtable->tableslot = NULL; /* will be made on first lookup */ |
208 | 200 | hashtable->inputslot = NULL; |
209 | 201 | hashtable->in_hash_expr = NULL; |
@@ -281,15 +273,6 @@ ResetTupleHashTable(TupleHashTable hashtable) |
281 | 273 | tuplehash_reset(hashtable->hashtab); |
282 | 274 | } |
283 | 275 |
|
284 | | -/* |
285 | | - * Return size of the hash bucket. Useful for estimating memory usage. |
286 | | - */ |
287 | | -size_t |
288 | | -TupleHashEntrySize(void) |
289 | | -{ |
290 | | - return sizeof(TupleHashEntryData); |
291 | | -} |
292 | | - |
293 | 276 | /* |
294 | 277 | * Find or create a hashtable entry for the tuple group containing the |
295 | 278 | * given tuple. The tuple must be the same type as the hashtable entries. |
@@ -356,24 +339,6 @@ TupleHashTableHash(TupleHashTable hashtable, TupleTableSlot *slot) |
356 | 339 | return hash; |
357 | 340 | } |
358 | 341 |
|
359 | | -MinimalTuple |
360 | | -TupleHashEntryGetTuple(TupleHashEntry entry) |
361 | | -{ |
362 | | - return entry->firstTuple; |
363 | | -} |
364 | | - |
365 | | -/* |
366 | | - * Get a pointer into the additional space allocated for this entry. The |
367 | | - * amount of space available is the additionalsize specified to |
368 | | - * BuildTupleHashTable(). If additionalsize was specified as zero, no |
369 | | - * additional space is available and this function should not be called. |
370 | | - */ |
371 | | -void * |
372 | | -TupleHashEntryGetAdditional(TupleHashEntry entry) |
373 | | -{ |
374 | | - return (char *) entry->firstTuple + MAXALIGN(entry->firstTuple->t_len); |
375 | | -} |
376 | | - |
377 | 342 | /* |
378 | 343 | * A variant of LookupTupleHashEntry for callers that have already computed |
379 | 344 | * the hash value. |
@@ -512,31 +477,13 @@ LookupTupleHashEntry_internal(TupleHashTable hashtable, TupleTableSlot *slot, |
512 | 477 | } |
513 | 478 | else |
514 | 479 | { |
515 | | - MinimalTuple firstTuple; |
516 | | - size_t totalsize; /* including alignment and additionalsize */ |
517 | | - |
518 | 480 | /* created new entry */ |
519 | 481 | *isnew = true; |
520 | 482 | /* zero caller data */ |
| 483 | + entry->additional = NULL; |
521 | 484 | MemoryContextSwitchTo(hashtable->tablecxt); |
522 | | - |
523 | 485 | /* Copy the first tuple into the table context */ |
524 | | - firstTuple = ExecCopySlotMinimalTuple(slot); |
525 | | - |
526 | | - /* |
527 | | - * Allocate additional space right after the MinimalTuple of size |
528 | | - * additionalsize. The caller can get a pointer to this data with |
529 | | - * TupleHashEntryGetAdditional(), and store arbitrary data there. |
530 | | - * |
531 | | - * This avoids the need to store an extra pointer or allocate an |
532 | | - * additional chunk, which would waste memory. |
533 | | - */ |
534 | | - totalsize = MAXALIGN(firstTuple->t_len) + hashtable->additionalsize; |
535 | | - firstTuple = repalloc(firstTuple, totalsize); |
536 | | - memset((char *) firstTuple + firstTuple->t_len, 0, |
537 | | - totalsize - firstTuple->t_len); |
538 | | - |
539 | | - entry->firstTuple = firstTuple; |
| 486 | + entry->firstTuple = ExecCopySlotMinimalTuple(slot); |
540 | 487 | } |
541 | 488 | } |
542 | 489 | else |
|
0 commit comments