|
PostgreSQL Source Code git master
|
#include "postgres.h"#include <math.h>#include "access/htup_details.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, MinimalTuple tuple1, MinimalTuple tuple2) |
| static uint32 | TupleHashTableHash_internal (struct tuplehash_hash *tb, 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 | BuildTupleHashTable (PlanState *parent, TupleDesc inputDesc, const TupleTableSlotOps *inputOps, int numCols, AttrNumber *keyColIdx, const Oid *eqfuncoids, FmgrInfo *hashfunctions, Oid *collations, double nelements, Size additionalsize, MemoryContext metacxt, MemoryContext tuplescxt, MemoryContext tempcxt, bool use_variable_hash_iv) |
| void | ResetTupleHashTable (TupleHashTable hashtable) |
| Size | EstimateTupleHashTableSpace (double nentries, Size tupleWidth, Size additionalsize) |
| 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, ExprState *hashexpr) |
| #define SH_DEFINE |
Definition at line 47 of file execGrouping.c.
| #define SH_ELEMENT_TYPE TupleHashEntryData |
Definition at line 39 of file execGrouping.c.
| #define SH_EQUAL | ( | tb, | |
| a, | |||
| b | |||
| ) | TupleHashTableMatch(tb, a, b) == 0 |
Definition at line 43 of file execGrouping.c.
Definition at line 46 of file execGrouping.c.
| #define SH_HASH_KEY | ( | tb, | |
| key | |||
| ) | TupleHashTableHash_internal(tb, key) |
Definition at line 42 of file execGrouping.c.
| #define SH_KEY firstTuple |
Definition at line 41 of file execGrouping.c.
| #define SH_KEY_TYPE MinimalTuple |
Definition at line 40 of file execGrouping.c.
| #define SH_PREFIX tuplehash |
Definition at line 38 of file execGrouping.c.
| #define SH_SCOPE extern |
Definition at line 44 of file execGrouping.c.
| #define SH_STORE_HASH |
Definition at line 45 of file execGrouping.c.
| TupleHashTable BuildTupleHashTable | ( | PlanState * | parent, |
| TupleDesc | inputDesc, | ||
| const TupleTableSlotOps * | inputOps, | ||
| int | numCols, | ||
| AttrNumber * | keyColIdx, | ||
| const Oid * | eqfuncoids, | ||
| FmgrInfo * | hashfunctions, | ||
| Oid * | collations, | ||
| double | nelements, | ||
| Size | additionalsize, | ||
| MemoryContext | metacxt, | ||
| MemoryContext | tuplescxt, | ||
| MemoryContext | tempcxt, | ||
| bool | use_variable_hash_iv | ||
| ) |
Definition at line 184 of file execGrouping.c.
References TupleHashTableData::additionalsize, Assert(), CreateStandaloneExprContext(), CreateTupleDescCopy(), TupleHashTableData::cur_eq_func, ExecBuildGroupingEqual(), ExecBuildHash32FromAttrs(), TupleHashTableData::exprcontext, TupleHashTableData::hashtab, TupleHashTableData::in_hash_expr, TupleHashTableData::inputslot, TupleHashTableData::keyColIdx, MakeSingleTupleTableSlot(), MAXALIGN, MemoryContextSwitchTo(), murmurhash32(), TupleHashTableData::numCols, palloc(), ParallelWorkerNumber, PG_UINT32_MAX, TupleHashTableData::tab_collations, TupleHashTableData::tab_eq_func, TupleHashTableData::tab_hash_expr, TupleHashTableData::tableslot, TupleHashTableData::tempcxt, TTSOpsMinimalTuple, and TupleHashTableData::tuplescxt.
Referenced by build_hash_table(), and buildSubPlanHash().
Definition at line 321 of file execGrouping.c.
References MAXALIGN, and SizeofMinimalTupleHeader.
Referenced by EstimateSetOpHashTableSpace(), and EstimateSubplanHashTableSpace().
| void execTuplesHashPrepare | ( | int | numCols, |
| const Oid * | eqOperators, | ||
| Oid ** | eqFuncOids, | ||
| FmgrInfo ** | hashFunctions | ||
| ) |
Definition at line 100 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 61 of file execGrouping.c.
References ExecBuildGroupingEqual(), get_opcode(), i, and palloc().
Referenced by build_pertrans_for_aggref(), ExecInitAgg(), ExecInitGroup(), ExecInitLimit(), ExecInitUnique(), ExecInitWindowAgg(), and hypothetical_dense_rank_final().
| TupleHashEntry FindTupleHashEntry | ( | TupleHashTable | hashtable, |
| TupleTableSlot * | slot, | ||
| ExprState * | eqcomp, | ||
| ExprState * | hashexpr | ||
| ) |
Definition at line 469 of file execGrouping.c.
References TupleHashTableData::cur_eq_func, TupleHashTableData::hashtab, TupleHashTableData::in_hash_expr, 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 382 of file execGrouping.c.
References Assert(), TupleHashTableData::cur_eq_func, hash(), TupleHashEntryData::hash, TupleHashTableData::hashtab, TupleHashTableData::in_hash_expr, TupleHashTableData::inputslot, LookupTupleHashEntry_internal(), MemoryContextSwitchTo(), TupleHashTableData::tab_eq_func, TupleHashTableData::tab_hash_expr, TupleHashTableData::tempcxt, and TupleHashTableHash_internal().
Referenced by buildSubPlanHash(), ExecRecursiveUnion(), lookup_hash_entries(), and setop_fill_hash_table().
|
inlinestatic |
Definition at line 550 of file execGrouping.c.
References TupleHashTableData::additionalsize, ExecCopySlotMinimalTupleExtra(), TupleHashEntryData::firstTuple, hash(), TupleHashTableData::hashtab, sort-test::key, MemoryContextSwitchTo(), and TupleHashTableData::tuplescxt.
Referenced by LookupTupleHashEntry(), and LookupTupleHashEntryHash().
| TupleHashEntry LookupTupleHashEntryHash | ( | TupleHashTable | hashtable, |
| TupleTableSlot * | slot, | ||
| bool * | isnew, | ||
| uint32 | hash | ||
| ) |
Definition at line 437 of file execGrouping.c.
References Assert(), TupleHashTableData::cur_eq_func, hash(), TupleHashEntryData::hash, TupleHashTableData::in_hash_expr, TupleHashTableData::inputslot, LookupTupleHashEntry_internal(), MemoryContextSwitchTo(), TupleHashTableData::tab_eq_func, TupleHashTableData::tab_hash_expr, and TupleHashTableData::tempcxt.
Referenced by agg_refill_hash_table().
| void ResetTupleHashTable | ( | TupleHashTable | hashtable | ) |
Definition at line 302 of file execGrouping.c.
References TupleHashTableData::hashtab, MemoryContextReset(), and TupleHashTableData::tuplescxt.
Referenced by agg_refill_hash_table(), build_hash_tables(), buildSubPlanHash(), ExecReScanRecursiveUnion(), and ExecReScanSetOp().
| uint32 TupleHashTableHash | ( | TupleHashTable | hashtable, |
| TupleTableSlot * | slot | ||
| ) |
Definition at line 414 of file execGrouping.c.
References hash(), TupleHashTableData::hashtab, TupleHashTableData::in_hash_expr, TupleHashTableData::inputslot, MemoryContextSwitchTo(), TupleHashTableData::tab_hash_expr, TupleHashTableData::tempcxt, and TupleHashTableHash_internal().
|
inlinestatic |
Definition at line 502 of file execGrouping.c.
References DatumGetUInt32(), ExprContext::ecxt_innertuple, ExecEvalExpr(), ExecStoreMinimalTuple(), TupleHashTableData::exprcontext, if(), TupleHashTableData::in_hash_expr, TupleHashTableData::inputslot, murmurhash32(), TupleHashTableData::tab_hash_expr, and TupleHashTableData::tableslot.
Referenced by LookupTupleHashEntry(), and TupleHashTableHash().
|
static |
Definition at line 601 of file execGrouping.c.
References Assert(), TupleHashTableData::cur_eq_func, ExecQualAndReset(), ExecStoreMinimalTuple(), TupleHashTableData::exprcontext, TupleHashTableData::inputslot, and TupleHashTableData::tableslot.