diff options
Diffstat (limited to 'src/include')
-rw-r--r-- | src/include/executor/execExpr.h | 24 | ||||
-rw-r--r-- | src/include/executor/executor.h | 7 | ||||
-rw-r--r-- | src/include/executor/hashjoin.h | 12 | ||||
-rw-r--r-- | src/include/executor/nodeHash.h | 9 | ||||
-rw-r--r-- | src/include/nodes/execnodes.h | 12 |
5 files changed, 38 insertions, 26 deletions
diff --git a/src/include/executor/execExpr.h b/src/include/executor/execExpr.h index 845f3422dea..eec0aa699e5 100644 --- a/src/include/executor/execExpr.h +++ b/src/include/executor/execExpr.h @@ -235,6 +235,13 @@ typedef enum ExprEvalOp /* evaluate a single domain CHECK constraint */ EEOP_DOMAIN_CHECK, + /* evaluation steps for hashing */ + EEOP_HASHDATUM_SET_INITVAL, + EEOP_HASHDATUM_FIRST, + EEOP_HASHDATUM_FIRST_STRICT, + EEOP_HASHDATUM_NEXT32, + EEOP_HASHDATUM_NEXT32_STRICT, + /* evaluate assorted special-purpose expression types */ EEOP_CONVERT_ROWTYPE, EEOP_SCALARARRAYOP, @@ -558,6 +565,23 @@ typedef struct ExprEvalStep ErrorSaveContext *escontext; } domaincheck; + /* for EEOP_HASH_SET_INITVAL */ + struct + { + Datum init_value; + + } hashdatum_initvalue; + + /* for EEOP_HASHDATUM_(FIRST|NEXT32)[_STRICT] */ + struct + { + FmgrInfo *finfo; /* function's lookup data */ + FunctionCallInfo fcinfo_data; /* arguments etc */ + /* faster to access without additional indirection: */ + PGFunction fn_addr; /* actual call address */ + int jumpdone; /* jump here on null */ + } hashdatum; + /* for EEOP_CONVERT_ROWTYPE */ struct { diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 9770752ea3c..046a7fb69b0 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -285,6 +285,13 @@ extern ExprState *ExecInitCheck(List *qual, PlanState *parent); extern List *ExecInitExprList(List *nodes, PlanState *parent); extern ExprState *ExecBuildAggTrans(AggState *aggstate, struct AggStatePerPhaseData *phase, bool doSort, bool doHash, bool nullcheck); +extern ExprState *ExecBuildHash32Expr(TupleDesc desc, + const TupleTableSlotOps *ops, + const Oid *hashfunc_oids, + const List *collations, + const List *hash_exprs, + const bool *opstrict, PlanState *parent, + uint32 init_value, bool keep_nulls); extern ExprState *ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, int numCols, diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index 9197846cda7..2d8ed8688cd 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -313,8 +313,6 @@ typedef struct HashJoinTableData dsa_pointer_atomic *shared; } buckets; - bool keepNulls; /* true to store unmatchable NULL tuples */ - bool skewEnabled; /* are we using skew optimization? */ HashSkewBucket **skewBucket; /* hashtable of skew buckets */ int skewBucketLen; /* size of skewBucket array (a power of 2!) */ @@ -343,16 +341,6 @@ typedef struct HashJoinTableData BufFile **innerBatchFile; /* buffered virtual temp file per batch */ BufFile **outerBatchFile; /* buffered virtual temp file per batch */ - /* - * Info about the datatype-specific hash functions for the datatypes being - * hashed. These are arrays of the same length as the number of hash join - * clauses (hash keys). - */ - FmgrInfo *outer_hashfunctions; /* lookup data for hash functions */ - FmgrInfo *inner_hashfunctions; /* lookup data for hash functions */ - bool *hashStrict; /* is each hash join operator strict? */ - Oid *collations; - Size spaceUsed; /* memory space currently used by tuples */ Size spaceAllowed; /* upper limit for space used */ Size spacePeak; /* peak space used */ diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h index a95911c2fee..e4eb7bc6359 100644 --- a/src/include/executor/nodeHash.h +++ b/src/include/executor/nodeHash.h @@ -24,8 +24,7 @@ extern Node *MultiExecHash(HashState *node); extern void ExecEndHash(HashState *node); extern void ExecReScanHash(HashState *node); -extern HashJoinTable ExecHashTableCreate(HashState *state, List *hashOperators, List *hashCollations, - bool keepNulls); +extern HashJoinTable ExecHashTableCreate(HashState *state); extern void ExecParallelHashTableAlloc(HashJoinTable hashtable, int batchno); extern void ExecHashTableDestroy(HashJoinTable hashtable); @@ -43,12 +42,6 @@ extern void ExecParallelHashTableInsert(HashJoinTable hashtable, extern void ExecParallelHashTableInsertCurrentBatch(HashJoinTable hashtable, TupleTableSlot *slot, uint32 hashvalue); -extern bool ExecHashGetHashValue(HashJoinTable hashtable, - ExprContext *econtext, - List *hashkeys, - bool outer_tuple, - bool keep_nulls, - uint32 *hashvalue); extern void ExecHashGetBucketAndBatch(HashJoinTable hashtable, uint32 hashvalue, int *bucketno, diff --git a/src/include/nodes/execnodes.h b/src/include/nodes/execnodes.h index 87f1519ec65..af7d8fd1e72 100644 --- a/src/include/nodes/execnodes.h +++ b/src/include/nodes/execnodes.h @@ -2184,8 +2184,7 @@ typedef struct MergeJoinState * HashJoinState information * * hashclauses original form of the hashjoin condition - * hj_OuterHashKeys the outer hash keys in the hashjoin condition - * hj_HashOperators the join operators in the hashjoin condition + * hj_OuterHash ExprState for hashing outer keys * hj_HashTable hash table for the hashjoin * (NULL if table not built yet) * hj_CurHashValue hash value for current outer tuple @@ -2215,9 +2214,7 @@ typedef struct HashJoinState { JoinState js; /* its first field is NodeTag */ ExprState *hashclauses; - List *hj_OuterHashKeys; /* list of ExprState nodes */ - List *hj_HashOperators; /* list of operator OIDs */ - List *hj_Collations; + ExprState *hj_OuterHash; HashJoinTable hj_HashTable; uint32 hj_CurHashValue; int hj_CurBucketNo; @@ -2770,7 +2767,10 @@ typedef struct HashState { PlanState ps; /* its first field is NodeTag */ HashJoinTable hashtable; /* hash table for the hashjoin */ - List *hashkeys; /* list of ExprState nodes */ + ExprState *hash_expr; /* ExprState to get hash value */ + + FmgrInfo *skew_hashfunction; /* lookup data for skew hash function */ + Oid skew_collation; /* collation to call skew_hashfunction with */ /* * In a parallelized hash join, the leader retains a pointer to the |