PostgreSQL Source Code
git master
|
#include "postgres.h"
#include "access/parallel.h"
#include "common/hashfn.h"
#include "executor/executor.h"
#include "miscadmin.h"
#include "utils/lsyscache.h"
#include "lib/simplehash.h"
Go to the source code of this file.
Macros | |
#define | SH_PREFIX tuplehash |
#define | SH_ELEMENT_TYPE TupleHashEntryData |
#define | SH_KEY_TYPE MinimalTuple |
#define | SH_KEY firstTuple |
#define | SH_HASH_KEY(tb, key) TupleHashTableHash_internal(tb, key) |
#define | SH_EQUAL(tb, a, b) TupleHashTableMatch(tb, a, b) == 0 |
#define | SH_SCOPE extern |
#define | SH_STORE_HASH |
#define | SH_GET_HASH(tb, a) a->hash |
#define | SH_DEFINE |
Functions | |
static int | TupleHashTableMatch (struct tuplehash_hash *tb, const MinimalTuple tuple1, const MinimalTuple tuple2) |
static uint32 | TupleHashTableHash_internal (struct tuplehash_hash *tb, const MinimalTuple tuple) |
static TupleHashEntry | LookupTupleHashEntry_internal (TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 hash) |
ExprState * | execTuplesMatchPrepare (TupleDesc desc, int numCols, const AttrNumber *keyColIdx, const Oid *eqOperators, const Oid *collations, PlanState *parent) |
void | execTuplesHashPrepare (int numCols, const Oid *eqOperators, Oid **eqFuncOids, FmgrInfo **hashFunctions) |
TupleHashTable | BuildTupleHashTableExt (PlanState *parent, TupleDesc inputDesc, int numCols, AttrNumber *keyColIdx, const Oid *eqfuncoids, FmgrInfo *hashfunctions, Oid *collations, long nbuckets, Size additionalsize, MemoryContext metacxt, MemoryContext tablecxt, MemoryContext tempcxt, bool use_variable_hash_iv) |
TupleHashTable | BuildTupleHashTable (PlanState *parent, TupleDesc inputDesc, int numCols, AttrNumber *keyColIdx, const Oid *eqfuncoids, FmgrInfo *hashfunctions, Oid *collations, long nbuckets, Size additionalsize, MemoryContext tablecxt, MemoryContext tempcxt, bool use_variable_hash_iv) |
void | ResetTupleHashTable (TupleHashTable hashtable) |
TupleHashEntry | LookupTupleHashEntry (TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 *hash) |
uint32 | TupleHashTableHash (TupleHashTable hashtable, TupleTableSlot *slot) |
TupleHashEntry | LookupTupleHashEntryHash (TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 hash) |
TupleHashEntry | FindTupleHashEntry (TupleHashTable hashtable, TupleTableSlot *slot, ExprState *eqcomp, FmgrInfo *hashfunctions) |
#define SH_DEFINE |
Definition at line 44 of file execGrouping.c.
#define SH_ELEMENT_TYPE TupleHashEntryData |
Definition at line 36 of file execGrouping.c.
#define SH_EQUAL | ( | tb, | |
a, | |||
b | |||
) | TupleHashTableMatch(tb, a, b) == 0 |
Definition at line 40 of file execGrouping.c.
Definition at line 43 of file execGrouping.c.
#define SH_HASH_KEY | ( | tb, | |
key | |||
) | TupleHashTableHash_internal(tb, key) |
Definition at line 39 of file execGrouping.c.
#define SH_KEY firstTuple |
Definition at line 38 of file execGrouping.c.
#define SH_KEY_TYPE MinimalTuple |
Definition at line 37 of file execGrouping.c.
#define SH_PREFIX tuplehash |
Definition at line 35 of file execGrouping.c.
#define SH_SCOPE extern |
Definition at line 41 of file execGrouping.c.
#define SH_STORE_HASH |
Definition at line 42 of file execGrouping.c.
TupleHashTable BuildTupleHashTable | ( | PlanState * | parent, |
TupleDesc | inputDesc, | ||
int | numCols, | ||
AttrNumber * | keyColIdx, | ||
const Oid * | eqfuncoids, | ||
FmgrInfo * | hashfunctions, | ||
Oid * | collations, | ||
long | nbuckets, | ||
Size | additionalsize, | ||
MemoryContext | tablecxt, | ||
MemoryContext | tempcxt, | ||
bool | use_variable_hash_iv | ||
) |
Definition at line 254 of file execGrouping.c.
References BuildTupleHashTableExt().
TupleHashTable BuildTupleHashTableExt | ( | PlanState * | parent, |
TupleDesc | inputDesc, | ||
int | numCols, | ||
AttrNumber * | keyColIdx, | ||
const Oid * | eqfuncoids, | ||
FmgrInfo * | hashfunctions, | ||
Oid * | collations, | ||
long | nbuckets, | ||
Size | additionalsize, | ||
MemoryContext | metacxt, | ||
MemoryContext | tablecxt, | ||
MemoryContext | tempcxt, | ||
bool | use_variable_hash_iv | ||
) |
Definition at line 153 of file execGrouping.c.
References Assert, CreateStandaloneExprContext(), CreateTupleDescCopy(), TupleHashTableData::cur_eq_func, TupleHashTableData::entrysize, ExecBuildGroupingEqual(), TupleHashTableData::exprcontext, get_hash_memory_limit(), TupleHashTableData::hash_iv, TupleHashTableData::hashtab, TupleHashTableData::in_hash_funcs, TupleHashTableData::inputslot, TupleHashTableData::keyColIdx, MakeSingleTupleTableSlot(), MemoryContextSwitchTo(), murmurhash32(), TupleHashTableData::numCols, palloc(), ParallelWorkerNumber, TupleHashTableData::tab_collations, TupleHashTableData::tab_eq_func, TupleHashTableData::tab_hash_funcs, TupleHashTableData::tablecxt, TupleHashTableData::tableslot, TupleHashTableData::tempcxt, and TTSOpsMinimalTuple.
Referenced by build_hash_table(), buildSubPlanHash(), and BuildTupleHashTable().
void execTuplesHashPrepare | ( | int | numCols, |
const Oid * | eqOperators, | ||
Oid ** | eqFuncOids, | ||
FmgrInfo ** | hashFunctions | ||
) |
Definition at line 95 of file execGrouping.c.
References Assert, elog, ERROR, fmgr_info(), get_op_hash_functions(), get_opcode(), i, and palloc().
Referenced by ExecInitRecursiveUnion(), ExecInitSetOp(), and find_hash_columns().
ExprState* execTuplesMatchPrepare | ( | TupleDesc | desc, |
int | numCols, | ||
const AttrNumber * | keyColIdx, | ||
const Oid * | eqOperators, | ||
const Oid * | collations, | ||
PlanState * | parent | ||
) |
Definition at line 58 of file execGrouping.c.
References ExecBuildGroupingEqual(), get_opcode(), i, and palloc().
Referenced by build_pertrans_for_aggref(), ExecInitAgg(), ExecInitGroup(), ExecInitLimit(), ExecInitSetOp(), ExecInitUnique(), ExecInitWindowAgg(), and hypothetical_dense_rank_final().
TupleHashEntry FindTupleHashEntry | ( | TupleHashTable | hashtable, |
TupleTableSlot * | slot, | ||
ExprState * | eqcomp, | ||
FmgrInfo * | hashfunctions | ||
) |
Definition at line 392 of file execGrouping.c.
References TupleHashTableData::cur_eq_func, TupleHashTableData::hashtab, TupleHashTableData::in_hash_funcs, TupleHashTableData::inputslot, sort-test::key, MemoryContextSwitchTo(), and TupleHashTableData::tempcxt.
Referenced by ExecHashSubPlan().
TupleHashEntry LookupTupleHashEntry | ( | TupleHashTable | hashtable, |
TupleTableSlot * | slot, | ||
bool * | isnew, | ||
uint32 * | hash | ||
) |
Definition at line 305 of file execGrouping.c.
References Assert, TupleHashTableData::cur_eq_func, hash(), TupleHashEntryData::hash, TupleHashTableData::hashtab, TupleHashTableData::in_hash_funcs, TupleHashTableData::inputslot, LookupTupleHashEntry_internal(), MemoryContextSwitchTo(), TupleHashTableData::tab_eq_func, TupleHashTableData::tab_hash_funcs, TupleHashTableData::tempcxt, and TupleHashTableHash_internal().
Referenced by buildSubPlanHash(), ExecRecursiveUnion(), lookup_hash_entries(), and setop_fill_hash_table().
|
inlinestatic |
Definition at line 495 of file execGrouping.c.
References TupleHashEntryData::additional, ExecCopySlotMinimalTuple(), TupleHashEntryData::firstTuple, hash(), TupleHashTableData::hashtab, sort-test::key, MemoryContextSwitchTo(), and TupleHashTableData::tablecxt.
Referenced by LookupTupleHashEntry(), and LookupTupleHashEntryHash().
TupleHashEntry LookupTupleHashEntryHash | ( | TupleHashTable | hashtable, |
TupleTableSlot * | slot, | ||
bool * | isnew, | ||
uint32 | hash | ||
) |
Definition at line 360 of file execGrouping.c.
References Assert, TupleHashTableData::cur_eq_func, hash(), TupleHashEntryData::hash, TupleHashTableData::in_hash_funcs, TupleHashTableData::inputslot, LookupTupleHashEntry_internal(), MemoryContextSwitchTo(), TupleHashTableData::tab_eq_func, TupleHashTableData::tab_hash_funcs, and TupleHashTableData::tempcxt.
Referenced by agg_refill_hash_table().
void ResetTupleHashTable | ( | TupleHashTable | hashtable | ) |
Definition at line 284 of file execGrouping.c.
References TupleHashTableData::hashtab.
Referenced by agg_refill_hash_table(), build_hash_tables(), buildSubPlanHash(), ExecReScanRecursiveUnion(), and ExecReScanSetOp().
uint32 TupleHashTableHash | ( | TupleHashTable | hashtable, |
TupleTableSlot * | slot | ||
) |
Definition at line 337 of file execGrouping.c.
References hash(), TupleHashTableData::hashtab, TupleHashTableData::in_hash_funcs, TupleHashTableData::inputslot, MemoryContextSwitchTo(), TupleHashTableData::tab_hash_funcs, TupleHashTableData::tempcxt, and TupleHashTableHash_internal().
|
inlinestatic |
Definition at line 425 of file execGrouping.c.
References DatumGetUInt32(), ExecStoreMinimalTuple(), FunctionCall1Coll(), TupleHashTableData::hash_iv, i, if(), TupleHashTableData::in_hash_funcs, TupleHashTableData::inputslot, TupleHashTableData::keyColIdx, murmurhash32(), TupleHashTableData::numCols, pg_rotate_left32(), slot_getattr(), TupleHashTableData::tab_collations, TupleHashTableData::tab_hash_funcs, and TupleHashTableData::tableslot.
Referenced by LookupTupleHashEntry(), and TupleHashTableHash().
|
static |
Definition at line 536 of file execGrouping.c.
References Assert, TupleHashTableData::cur_eq_func, ExecQualAndReset(), ExecStoreMinimalTuple(), TupleHashTableData::exprcontext, TupleHashTableData::inputslot, and TupleHashTableData::tableslot.