38#define SH_PREFIX tuplehash
39#define SH_ELEMENT_TYPE TupleHashEntryData
40#define SH_KEY_TYPE MinimalTuple
41#define SH_KEY firstTuple
42#define SH_HASH_KEY(tb, key) TupleHashTableHash_internal(tb, key)
43#define SH_EQUAL(tb, a, b) TupleHashTableMatch(tb, a, b) == 0
44#define SH_SCOPE extern
46#define SH_GET_HASH(tb, a) a->hash
64 const Oid *eqOperators,
65 const Oid *collations,
78 for (
i = 0;
i < numCols;
i++)
101 const Oid *eqOperators,
110 for (
i = 0;
i < numCols;
i++)
112 Oid eq_opr = eqOperators[
i];
120 elog(
ERROR,
"could not find hash function for hash operator %u",
189 const Oid *eqfuncoids,
212 if (
isnan(nelements) || nelements <= 0)
217 nbuckets = (
uint32) nelements;
223 additionalsize =
MAXALIGN(additionalsize);
275 keyColIdx, eqfuncoids, collations,
#define Assert(condition)
ExprState * ExecBuildHash32FromAttrs(TupleDesc desc, const TupleTableSlotOps *ops, FmgrInfo *hashfunctions, Oid *collations, int numCols, AttrNumber *keyColIdx, PlanState *parent, uint32 init_value)
ExprState * ExecBuildGroupingEqual(TupleDesc ldesc, TupleDesc rdesc, const TupleTableSlotOps *lops, const TupleTableSlotOps *rops, int numCols, const AttrNumber *keyColIdx, const Oid *eqfunctions, const Oid *collations, PlanState *parent)
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)
static int TupleHashTableMatch(struct tuplehash_hash *tb, MinimalTuple tuple1, MinimalTuple tuple2)
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)
TupleHashEntry LookupTupleHashEntryHash(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 hash)
static uint32 TupleHashTableHash_internal(struct tuplehash_hash *tb, MinimalTuple tuple)
TupleHashEntry LookupTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 *hash)
uint32 TupleHashTableHash(TupleHashTable hashtable, TupleTableSlot *slot)
TupleHashEntry FindTupleHashEntry(TupleHashTable hashtable, TupleTableSlot *slot, ExprState *eqcomp, ExprState *hashexpr)
Size EstimateTupleHashTableSpace(double nentries, Size tupleWidth, Size additionalsize)
void ResetTupleHashTable(TupleHashTable hashtable)
static TupleHashEntry LookupTupleHashEntry_internal(TupleHashTable hashtable, TupleTableSlot *slot, bool *isnew, uint32 hash)
TupleTableSlot * MakeSingleTupleTableSlot(TupleDesc tupdesc, const TupleTableSlotOps *tts_ops)
TupleTableSlot * ExecStoreMinimalTuple(MinimalTuple mtup, TupleTableSlot *slot, bool shouldFree)
const TupleTableSlotOps TTSOpsMinimalTuple
ExprContext * CreateStandaloneExprContext(void)
struct TupleHashTableData * TupleHashTable
static bool ExecQualAndReset(ExprState *state, ExprContext *econtext)
static Datum ExecEvalExpr(ExprState *state, ExprContext *econtext, bool *isNull)
#define palloc_object(type)
void fmgr_info(Oid functionId, FmgrInfo *finfo)
static uint32 murmurhash32(uint32 data)
#define SizeofMinimalTupleHeader
RegProcedure get_opcode(Oid opno)
bool get_op_hash_functions(Oid opno, RegProcedure *lhs_procno, RegProcedure *rhs_procno)
void MemoryContextReset(MemoryContext context)
static MemoryContext MemoryContextSwitchTo(MemoryContext context)
static uint32 DatumGetUInt32(Datum X)
static unsigned hash(unsigned *uv, int n)
TupleTableSlot * ecxt_innertuple
TupleTableSlot * ecxt_outertuple
ExprState * tab_hash_expr
TupleTableSlot * tableslot
ExprContext * exprcontext
TupleTableSlot * inputslot
TupleDesc CreateTupleDescCopy(TupleDesc tupdesc)
static MinimalTuple ExecCopySlotMinimalTupleExtra(TupleTableSlot *slot, Size extra)