| 1 | /*------------------------------------------------------------------------- |
| 2 | * |
| 3 | * nodeHash.h |
| 4 | * prototypes for nodeHash.c |
| 5 | * |
| 6 | * |
| 7 | * Portions Copyright (c) 1996-2019, PostgreSQL Global Development Group |
| 8 | * Portions Copyright (c) 1994, Regents of the University of California |
| 9 | * |
| 10 | * src/include/executor/nodeHash.h |
| 11 | * |
| 12 | *------------------------------------------------------------------------- |
| 13 | */ |
| 14 | #ifndef NODEHASH_H |
| 15 | #define NODEHASH_H |
| 16 | |
| 17 | #include "access/parallel.h" |
| 18 | #include "nodes/execnodes.h" |
| 19 | |
| 20 | struct SharedHashJoinBatch; |
| 21 | |
| 22 | extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags); |
| 23 | extern Node *MultiExecHash(HashState *node); |
| 24 | extern void ExecEndHash(HashState *node); |
| 25 | extern void ExecReScanHash(HashState *node); |
| 26 | |
| 27 | extern HashJoinTable ExecHashTableCreate(HashState *state, List *hashOperators, List *hashCollations, |
| 28 | bool keepNulls); |
| 29 | extern void ExecParallelHashTableAlloc(HashJoinTable hashtable, |
| 30 | int batchno); |
| 31 | extern void ExecHashTableDestroy(HashJoinTable hashtable); |
| 32 | extern void ExecHashTableDetach(HashJoinTable hashtable); |
| 33 | extern void ExecHashTableDetachBatch(HashJoinTable hashtable); |
| 34 | extern void ExecParallelHashTableSetCurrentBatch(HashJoinTable hashtable, |
| 35 | int batchno); |
| 36 | |
| 37 | extern void ExecHashTableInsert(HashJoinTable hashtable, |
| 38 | TupleTableSlot *slot, |
| 39 | uint32 hashvalue); |
| 40 | extern void ExecParallelHashTableInsert(HashJoinTable hashtable, |
| 41 | TupleTableSlot *slot, |
| 42 | uint32 hashvalue); |
| 43 | extern void ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable, |
| 44 | TupleTableSlot *slot, |
| 45 | uint32 hashvalue); |
| 46 | extern bool ExecHashGetHashValue(HashJoinTable hashtable, |
| 47 | ExprContext *econtext, |
| 48 | List *hashkeys, |
| 49 | bool outer_tuple, |
| 50 | bool keep_nulls, |
| 51 | uint32 *hashvalue); |
| 52 | extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable, |
| 53 | uint32 hashvalue, |
| 54 | int *bucketno, |
| 55 | int *batchno); |
| 56 | extern bool ExecScanHashBucket(HashJoinState *hjstate, ExprContext *econtext); |
| 57 | extern bool ExecParallelScanHashBucket(HashJoinState *hjstate, ExprContext *econtext); |
| 58 | extern void ExecPrepHashTableForUnmatched(HashJoinState *hjstate); |
| 59 | extern bool ExecScanHashTableForUnmatched(HashJoinState *hjstate, |
| 60 | ExprContext *econtext); |
| 61 | extern void ExecHashTableReset(HashJoinTable hashtable); |
| 62 | extern void ExecHashTableResetMatchFlags(HashJoinTable hashtable); |
| 63 | extern void ExecChooseHashTableSize(double ntuples, int tupwidth, bool useskew, |
| 64 | bool try_combined_work_mem, |
| 65 | int parallel_workers, |
| 66 | size_t *space_allowed, |
| 67 | int *numbuckets, |
| 68 | int *numbatches, |
| 69 | int *num_skew_mcvs); |
| 70 | extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue); |
| 71 | extern void ExecHashEstimate(HashState *node, ParallelContext *pcxt); |
| 72 | extern void ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt); |
| 73 | extern void ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt); |
| 74 | extern void ExecHashRetrieveInstrumentation(HashState *node); |
| 75 | extern void ExecShutdownHash(HashState *node); |
| 76 | extern void ExecHashGetInstrumentation(HashInstrumentation *instrument, |
| 77 | HashJoinTable hashtable); |
| 78 | |
| 79 | #endif /* NODEHASH_H */ |
| 80 | |