From 205b4619b1aedb7e313ae2e3df6106662f22084b Mon Sep 17 00:00:00 2001 From: li-qinlang Date: Fri, 22 Dec 2023 18:49:43 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8DgetWeights=E9=9D=99=E6=80=81?= =?UTF-8?q?=E5=85=A8=E5=B1=80=E5=8F=98=E9=87=8F=E7=BC=BA=E9=99=B7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/backend/utils/adt/tsrank.cpp | 3 ++- src/include/knl/knl_session.h | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/common/backend/utils/adt/tsrank.cpp b/src/common/backend/utils/adt/tsrank.cpp index 5abf78cf5..58ef32aa0 100644 --- a/src/common/backend/utils/adt/tsrank.cpp +++ b/src/common/backend/utils/adt/tsrank.cpp @@ -342,9 +342,10 @@ static float calc_rank(const float* w, TSVector t, TSQuery q, int4 method) static float* getWeights(ArrayType* win) { - static float ws[lengthof(weights)]; int i; float4* arrdata = NULL; + float* ws = u_sess->utils_cxt.tsrankWs; + Assert(sizeof(u_sess->utils_cxt.tsrankWs) == sizeof(weights)); if (win == NULL) return weights; diff --git a/src/include/knl/knl_session.h b/src/include/knl/knl_session.h index b54734602..e53dc1f1c 100644 --- a/src/include/knl/knl_session.h +++ b/src/include/knl/knl_session.h @@ -70,6 +70,8 @@ #include "tcop/dest.h" #include "og_record_time.h" +#define TSRANK_WEIGHTS_LEN 4 + typedef void (*pg_on_exit_callback)(int code, Datum arg); /* all session level attribute which expose to user. */ @@ -691,6 +693,9 @@ typedef struct knl_u_utils_context { HTAB* set_user_params_htab; DestReceiver* spi_printtupDR; + + /* var in tsrank.cpp */ + float tsrankWs[TSRANK_WEIGHTS_LEN]; } knl_u_utils_context; typedef struct knl_u_security_context {