!1831 新增插件列存表函数hash,并在使用插件时进行hash表的替换
Merge pull request !1831 from Cross-罗/column_hash
This commit is contained in:
@ -740,6 +740,12 @@ static void knl_g_audit_init(knl_g_audit_context *audit_cxt)
|
||||
}
|
||||
}
|
||||
|
||||
void knl_plugin_vec_func_init(knl_g_plugin_vec_func_context* func_cxt) {
|
||||
for (int i = 0; i < PLUGIN_VEC_FUNC_HATB_COUNT; i++) {
|
||||
func_cxt->vec_func_plugin[i] = NULL;
|
||||
}
|
||||
}
|
||||
|
||||
void knl_instance_init()
|
||||
{
|
||||
g_instance.binaryupgrade = false;
|
||||
@ -831,6 +837,7 @@ void knl_instance_init()
|
||||
knl_g_streaming_dr_init(&g_instance.streaming_dr_cxt);
|
||||
knl_g_csn_barrier_init(&g_instance.csn_barrier_cxt);
|
||||
knl_g_audit_init(&g_instance.audit_cxt);
|
||||
knl_plugin_vec_func_init(&g_instance.plugin_vec_func_cxt);
|
||||
}
|
||||
|
||||
void add_numa_alloc_info(void* numaAddr, size_t length)
|
||||
|
@ -1990,7 +1990,15 @@ void InitVectorFunction(FunctionCallInfo finfo, MemoryContext fcacheCxt)
|
||||
|
||||
Oid foid = finfo->flinfo->fn_oid;
|
||||
|
||||
entry = (VecFuncCacheEntry*)hash_search(g_instance.vec_func_hash, &foid, HASH_FIND, &found);
|
||||
struct HTAB* vec_func_hash = NULL;
|
||||
if (u_sess->attr.attr_sql.dolphin &&
|
||||
g_instance.plugin_vec_func_cxt.vec_func_plugin[DOLPHIN_VEC] != NULL) {
|
||||
vec_func_hash = g_instance.plugin_vec_func_cxt.vec_func_plugin[DOLPHIN_VEC];
|
||||
} else {
|
||||
vec_func_hash = g_instance.vec_func_hash;
|
||||
}
|
||||
|
||||
entry = (VecFuncCacheEntry*)hash_search(vec_func_hash, &foid, HASH_FIND, &found);
|
||||
|
||||
if (found && entry->vec_fn_cache[0] != NULL) {
|
||||
finfo->flinfo->vec_fn_cache = &entry->vec_fn_cache[0];
|
||||
|
@ -146,6 +146,20 @@ typedef struct knl_g_cost_context {
|
||||
|
||||
} knl_g_cost_context;
|
||||
|
||||
enum plugin_vecfunc_type {
|
||||
DOLPHIN_VEC = 0,
|
||||
|
||||
/*
|
||||
* This is the number of vecfunc hash tables.
|
||||
* If you are adding a new plugin hash table, do not place an enumeration after it.
|
||||
*/
|
||||
PLUGIN_VEC_FUNC_HATB_COUNT,
|
||||
};
|
||||
|
||||
typedef struct knl_g_plugin_vec_func_context {
|
||||
struct HTAB* vec_func_plugin[PLUGIN_VEC_FUNC_HATB_COUNT];
|
||||
} knl_g_plugin_vec_func_context;
|
||||
|
||||
typedef struct knl_g_pid_context {
|
||||
ThreadId StartupPID;
|
||||
ThreadId TwoPhaseCleanerPID;
|
||||
@ -1148,6 +1162,7 @@ typedef struct knl_instance_context {
|
||||
uint64 global_session_seq;
|
||||
|
||||
struct HTAB* vec_func_hash;
|
||||
knl_g_plugin_vec_func_context plugin_vec_func_cxt;
|
||||
|
||||
MemoryContext instance_context;
|
||||
MemoryContext error_context;
|
||||
|
Reference in New Issue
Block a user