diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-22 22:04:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-06-22 22:04:55 +0000 |
commit | bff0422b6c8f65b2f8210d8690a7f63f8d6e2782 (patch) | |
tree | a3ec649b7c6251efdae2be1b923462979ad7184e /src/include/executor | |
parent | 0dda75f6eb4bb9d65a7c2ad729fbf21d616c1bb1 (diff) | |
download | postgresql-bff0422b6c8f65b2f8210d8690a7f63f8d6e2782.tar.gz postgresql-bff0422b6c8f65b2f8210d8690a7f63f8d6e2782.zip |
Revise hash join and hash aggregation code to use the same datatype-
specific hash functions used by hash indexes, rather than the old
not-datatype-aware ComputeHashFunc routine. This makes it safe to do
hash joining on several datatypes that previously couldn't use hashing.
The sets of datatypes that are hash indexable and hash joinable are now
exactly the same, whereas before each had some that weren't in the other.
Diffstat (limited to 'src/include/executor')
-rw-r--r-- | src/include/executor/executor.h | 9 | ||||
-rw-r--r-- | src/include/executor/hashjoin.h | 13 | ||||
-rw-r--r-- | src/include/executor/nodeHash.h | 4 |
3 files changed, 15 insertions, 11 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 707b8c9fa62..04e630451f2 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: executor.h,v 1.94 2003/05/06 20:26:28 tgl Exp $ + * $Id: executor.h,v 1.95 2003/06/22 22:04:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -57,9 +57,14 @@ extern bool execTuplesUnequal(HeapTuple tuple1, extern FmgrInfo *execTuplesMatchPrepare(TupleDesc tupdesc, int numCols, AttrNumber *matchColIdx); -extern uint32 ComputeHashFunc(Datum key, int typLen, bool byVal); +extern void execTuplesHashPrepare(TupleDesc tupdesc, + int numCols, + AttrNumber *matchColIdx, + FmgrInfo **eqfunctions, + FmgrInfo **hashfunctions); extern TupleHashTable BuildTupleHashTable(int numCols, AttrNumber *keyColIdx, FmgrInfo *eqfunctions, + FmgrInfo *hashfunctions, int nbuckets, Size entrysize, MemoryContext tablecxt, MemoryContext tempcxt); diff --git a/src/include/executor/hashjoin.h b/src/include/executor/hashjoin.h index a2d5f633fcd..da7e0bf98c4 100644 --- a/src/include/executor/hashjoin.h +++ b/src/include/executor/hashjoin.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: hashjoin.h,v 1.27 2002/11/30 00:08:20 tgl Exp $ + * $Id: hashjoin.h,v 1.28 2003/06/22 22:04:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -69,13 +69,12 @@ typedef struct HashTableData * file */ /* - * Info about the datatypes being hashed. We assume that the inner and - * outer sides of each hashclause are the same type, or at least - * binary-compatible types. Each of these fields points to an array - * of the same length as the number of hash keys. + * Info about the datatype-specific hash functions for the datatypes + * being hashed. We assume that the inner and outer sides of each + * hashclause are the same type, or at least share the same hash function. + * This is an array of the same length as the number of hash keys. */ - int16 *typLens; - bool *typByVals; + FmgrInfo *hashfunctions; /* lookup data for hash functions */ /* * During 1st scan of inner relation, we get tuples from executor. If diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h index da1113b32da..d6d7ea627ea 100644 --- a/src/include/executor/nodeHash.h +++ b/src/include/executor/nodeHash.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2002, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Id: nodeHash.h,v 1.29 2003/01/10 23:54:24 tgl Exp $ + * $Id: nodeHash.h,v 1.30 2003/06/22 22:04:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -22,7 +22,7 @@ extern TupleTableSlot *ExecHash(HashState *node); extern void ExecEndHash(HashState *node); extern void ExecReScanHash(HashState *node, ExprContext *exprCtxt); -extern HashJoinTable ExecHashTableCreate(Hash *node); +extern HashJoinTable ExecHashTableCreate(Hash *node, List *hashOperators); extern void ExecHashTableDestroy(HashJoinTable hashtable); extern void ExecHashTableInsert(HashJoinTable hashtable, ExprContext *econtext, |