add computeHashHook

This commit is contained in:
ganyang
2022-08-11 14:41:13 +08:00
parent 0618e56b81
commit c69474b03a
3 changed files with 6 additions and 0 deletions

View File

@ -708,6 +708,9 @@ Datum compute_hash(Oid type, Datum value, char locator)
return DirectFunctionCall1(uuid_hash, value);
default:
if (u_sess->hook_cxt.computeHashHook != NULL) {
return ((computeHashFunc)(u_sess->hook_cxt.computeHashHook))(type, value, locator);
}
ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE),
errmsg("Unhandled datatype for modulo or hash distribution\n")));
}

View File

@ -440,4 +440,6 @@ extern uint32 hash_multikey(MultiHashKey* mkeys);
#define GetBucketID(hashval, hashmapsize) (compute_modulo(abs((int)hashval), hashmapsize))
typedef Datum (*computeHashFunc)(Oid type, Datum value, char locator);
#endif /* HASH_H */

View File

@ -2640,6 +2640,7 @@ typedef struct knl_u_hook_context {
void *analyzerRoutineHook;
void *transformStmtHook;
void *execInitExprHook;
void *computeHashHook;
} knl_u_hook_context;
typedef struct knl_session_context {