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
20struct SharedHashJoinBatch;
21
22extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags);
23extern Node *MultiExecHash(HashState *node);
24extern void ExecEndHash(HashState *node);
25extern void ExecReScanHash(HashState *node);
26
27extern HashJoinTable ExecHashTableCreate(HashState *state, List *hashOperators, List *hashCollations,
28 bool keepNulls);
29extern void ExecParallelHashTableAlloc(HashJoinTable hashtable,
30 int batchno);
31extern void ExecHashTableDestroy(HashJoinTable hashtable);
32extern void ExecHashTableDetach(HashJoinTable hashtable);
33extern void ExecHashTableDetachBatch(HashJoinTable hashtable);
34extern void ExecParallelHashTableSetCurrentBatch(HashJoinTable hashtable,
35 int batchno);
36
37extern void ExecHashTableInsert(HashJoinTable hashtable,
38 TupleTableSlot *slot,
39 uint32 hashvalue);
40extern void ExecParallelHashTableInsert(HashJoinTable hashtable,
41 TupleTableSlot *slot,
42 uint32 hashvalue);
43extern void ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable,
44 TupleTableSlot *slot,
45 uint32 hashvalue);
46extern bool ExecHashGetHashValue(HashJoinTable hashtable,
47 ExprContext *econtext,
48 List *hashkeys,
49 bool outer_tuple,
50 bool keep_nulls,
51 uint32 *hashvalue);
52extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable,
53 uint32 hashvalue,
54 int *bucketno,
55 int *batchno);
56extern bool ExecScanHashBucket(HashJoinState *hjstate, ExprContext *econtext);
57extern bool ExecParallelScanHashBucket(HashJoinState *hjstate, ExprContext *econtext);
58extern void ExecPrepHashTableForUnmatched(HashJoinState *hjstate);
59extern bool ExecScanHashTableForUnmatched(HashJoinState *hjstate,
60 ExprContext *econtext);
61extern void ExecHashTableReset(HashJoinTable hashtable);
62extern void ExecHashTableResetMatchFlags(HashJoinTable hashtable);
63extern 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);
70extern int ExecHashGetSkewBucket(HashJoinTable hashtable, uint32 hashvalue);
71extern void ExecHashEstimate(HashState *node, ParallelContext *pcxt);
72extern void ExecHashInitializeDSM(HashState *node, ParallelContext *pcxt);
73extern void ExecHashInitializeWorker(HashState *node, ParallelWorkerContext *pwcxt);
74extern void ExecHashRetrieveInstrumentation(HashState *node);
75extern void ExecShutdownHash(HashState *node);
76extern void ExecHashGetInstrumentation(HashInstrumentation *instrument,
77 HashJoinTable hashtable);
78
79#endif /* NODEHASH_H */
80