From 78ea45ca1312599f6a3eac43adff77a5c005b445 Mon Sep 17 00:00:00 2001 From: chendong76 <1209756284@qq.com> Date: Wed, 8 Feb 2023 15:33:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=BC=80=E5=90=AFpartial=20s?= =?UTF-8?q?eq=20scan=E5=90=8ESeq=20Scan=E7=AE=97=E5=AD=90=E5=88=9D?= =?UTF-8?q?=E5=A7=8B=E5=8C=96=E6=9C=9F=E9=97=B4core?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/common/backend/utils/misc/guc/guc_sql.cpp | 4 ++-- src/gausskernel/runtime/executor/nodeSeqscan.cpp | 6 +++--- src/test/regress/expected/update.out | 8 ++++++++ src/test/regress/sql/update.sql | 8 ++++++++ 4 files changed, 21 insertions(+), 5 deletions(-) diff --git a/src/common/backend/utils/misc/guc/guc_sql.cpp b/src/common/backend/utils/misc/guc/guc_sql.cpp index a12c8758e59..42e018ba047 100755 --- a/src/common/backend/utils/misc/guc/guc_sql.cpp +++ b/src/common/backend/utils/misc/guc/guc_sql.cpp @@ -3888,10 +3888,10 @@ static void AssignUStoreAttr(const char* newval, void* extra) if (!IS_NULL_STR(ptoken)) { if (strcasecmp(ptoken, "enable_ustore_partial_seqscan") == 0) { ParseUStoreBool(&u_sess->attr.attr_storage.enable_ustore_partial_seqscan, ptoken, pdelimiter, psave); - status[ENABLE_USTORE_PARTIAL_SEQSCAN_IDX] = true; + status[ENABLE_USTORE_PARTIAL_SEQSCAN_IDX] = false; } else if (strcasecmp(ptoken, "enable_candidate_buf_usage_count") == 0) { ParseUStoreBool(&u_sess->attr.attr_storage.enable_candidate_buf_usage_count, ptoken, pdelimiter, psave); - status[ENABLE_CANDIATATE_BUF_USAGE_IDX] = true; + status[ENABLE_CANDIATATE_BUF_USAGE_IDX] = false; } else if (strcasecmp(ptoken, "ustats_tracker_naptime") == 0) { ParseUStoreInt(&u_sess->attr.attr_storage.ustats_tracker_naptime, ptoken, pdelimiter, psave, MIN_USTATS_TRACKER_NAPTIME, MAX_USTATS_TRACKER_NAPTIME); diff --git a/src/gausskernel/runtime/executor/nodeSeqscan.cpp b/src/gausskernel/runtime/executor/nodeSeqscan.cpp index e95999450bd..46949650c61 100644 --- a/src/gausskernel/runtime/executor/nodeSeqscan.cpp +++ b/src/gausskernel/runtime/executor/nodeSeqscan.cpp @@ -827,8 +827,8 @@ static inline void FlatTLtoBool(const List* targetList, bool* boolArr, AttrNumbe { ListCell* tl = NULL; foreach (tl, targetList) { - GenericExprState* gstate = (GenericExprState*)lfirst(tl); - Var* variable = (Var*)gstate->xprstate.expr; + TargetEntry* tle = (TargetEntry*)lfirst(tl); + Var* variable = (Var*)tle->expr; Assert(variable != NULL); /* if this happens we've messed up */ if ((variable->varoattno > 0) && (variable->varoattno <= natts)) { boolArr[variable->varoattno - 1] = false; /* sometimes varattno in parent is different */ @@ -1049,7 +1049,7 @@ SeqScanState* ExecInitSeqScan(SeqScan* node, EState* estate, int eflags) FlatTLtoBool(scanstate->ps.plan->flatList, isNullProj, natts); if (scanstate->ps.plan->targetlist->length < natts) if (scanstate->ps.plan->targetlist->length > scanstate->ps.plan->flatList->length) { - FlatTLtoBool(scanstate->ps.plan->targetlist, isNullProj, natts); /* parent unaware of 'HAVING' clause */ + TLtoBool(scanstate->ps.plan->targetlist, isNullProj, natts); /* parent unaware of 'HAVING' clause */ } if ((scanstate->ps.plan->qual != NULL) && (scanstate->ps.plan->qual->length > 0)) /* query has qualifications */ diff --git a/src/test/regress/expected/update.out b/src/test/regress/expected/update.out index f11aa71fed9..7b93c50ec31 100644 --- a/src/test/regress/expected/update.out +++ b/src/test/regress/expected/update.out @@ -809,3 +809,11 @@ ERROR: relation "t_t_mutil_t2" already exists in schema "public" DETAIL: creating new table with existing name in the same schema update t_t_mutil_t1 a,t_t_mutil_t2 b set b.col2=5,a.col2=4 where a.col1=b.col1; ERROR: multi-relation update only support in B-format database +--ustore update +set ustore_attr to 'enable_candidate_buf_usage_count=true;enable_ustore_partial_seqscan=true'; +drop table if exists ustore_t1; +NOTICE: table "ustore_t1" does not exist, skipping +create table ustore_t1(id int, name varchar(10)) with (storage_type = ustore); +insert into ustore_t1 values(1, 'a'); +update ustore_t1 set ustore_t1.name = 'b' where ustore_t1.id = 1; +drop table ustore_t1; diff --git a/src/test/regress/sql/update.sql b/src/test/regress/sql/update.sql index faea8182e54..e5c4c05c035 100644 --- a/src/test/regress/sql/update.sql +++ b/src/test/regress/sql/update.sql @@ -344,3 +344,11 @@ drop table test; create table t_t_mutil_t1(col1 int,col2 int); create table t_t_mutil_t2(col1 int,col2 int); update t_t_mutil_t1 a,t_t_mutil_t2 b set b.col2=5,a.col2=4 where a.col1=b.col1; + +--ustore update +set ustore_attr to 'enable_candidate_buf_usage_count=true;enable_ustore_partial_seqscan=true'; +drop table if exists ustore_t1; +create table ustore_t1(id int, name varchar(10)) with (storage_type = ustore); +insert into ustore_t1 values(1, 'a'); +update ustore_t1 set ustore_t1.name = 'b' where ustore_t1.id = 1; +drop table ustore_t1; -- Gitee