From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 8A2046EC5B; Wed, 14 Apr 2021 01:50:37 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 8A2046EC5B DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1618354237; bh=pNUtXvfAqxrhvEIPa6cJX2oyyVbHmYeo5xRzzZokG9s=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=qxcBLKKswhQBY/nDiI35H4d9eqYba1tOtTEozxTMGSCf7VvB12le6J7MWpn+GpCm2 HEKc8Kb8eqqeIH9JEtUm35KYLEDIuesXoEIGjjbD5+dSxEdudEWcTSutU9Ucd5niKS EBh04GRHIxTMWespo+BKbBmN7PNfvj972urJDuVE= Received: from smtp58.i.mail.ru (smtp58.i.mail.ru [217.69.128.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 93B106EC5B for ; Wed, 14 Apr 2021 01:50:35 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 93B106EC5B Received: by smtp58.i.mail.ru with esmtpa (envelope-from ) id 1lWRre-0004Xm-MX; Wed, 14 Apr 2021 01:50:35 +0300 Date: Wed, 14 Apr 2021 01:50:33 +0300 To: Vladislav Shpilevoy Message-ID: <20210413225033.GA61932@tarantool.org> References: <05413fe121d62c5163593436df9fc8f1a7d2c295.1617984948.git.imeevma@gmail.com> <4da58298-a3b1-f4fd-c95c-955b1a0a41ad@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <4da58298-a3b1-f4fd-c95c-955b1a0a41ad@tarantool.org> X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD92FFCB8E6708E7480257C85EA0BB7A95D5E28B957962BB550182A05F5380850400D8BDA1AD6A317E90BAB371AA0D90861B0BF042DC33373D8028FB01823498BFD X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7495A032B936E882FEA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637EEA194BB48C104EF8638F802B75D45FF914D58D5BE9E6BC1A93B80C6DEB9DEE97C6FB206A91F05B2CF7D82D89F272443103D2E612871F55E44A6ACC89FD899E7D2E47CDBA5A96583C09775C1D3CA48CFCF36E64A7E3F8E58117882F4460429724CE54428C33FAD30A8DF7F3B2552694AC26CFBAC0749D213D2E47CDBA5A9658378DA827A17800CE75A31C54DA8CF07A79FA2833FD35BB23DF004C90652538430302FCEF25BFAB3454AD6D5ED66289B5278DA827A17800CE71C9B371AE64D57C8D32BA5DBAC0009BE395957E7521B51C20BC6067A898B09E4090A508E0FED6299176DF2183F8FC7C00A5971FBB7557E96B3661434B16C20AC78D18283394535A9E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B630C12C51E7AE69A2089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A2368A440D3B0F6089093C9A16E5BC824A2A04A2ABAA09D25379311020FFC8D4ADD69086D7A80F17D38ED1BEDF3AE47ADF X-C1DE0DAB: 0D63561A33F958A5965C243D70CC97A61B75C7EDB38FC05E2F729F422C9C3B26D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7502E6951B79FF9A3F410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34A783A638E01A3CDE52E5582EDCF4E2C9BFFBB077BCA4B0E4B443189326F0A09C23939DD5AB9D33061D7E09C32AA3244C8879FFE3F1E795995548FF764E49FBCE30452B15D76AEC14FACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojnA7/qPBUIXHdSOltq9DGCA== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306ED11570C70F33A6B640BAB371AA0D908618FF8BC079CCEBBDC5105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF7402F9BA4338D657ED14614B50AE0675 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 37/52] sql: introduce mem_set_null_clear() X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: Mergen Imeev Cc: tarantool-patches@dev.tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Thank you for the review! My answer, diff and new patch below. On Tue, Apr 13, 2021 at 01:38:18AM +0200, Vladislav Shpilevoy wrote: > Nice fixes! > > > diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c > > index 7f1e0bcbe..4566606d7 100644 > > --- a/src/box/sql/vdbe.c > > +++ b/src/box/sql/vdbe.c > > @@ -855,7 +855,7 @@ case OP_String: { /* out2 */ > > * is less than P2 (typically P3 is zero) then only register P2 is > > * set to NULL. > > * > > - * If the P1 value is non-zero, then also set the MEM_Cleared flag so that > > + * If the P1 value is non-zero, then also set the Cleared flag so that > > The flag is still here. If you didn't remove it, I would propose to > keep its mentions in the comments. > Fixed, dropped this change. > > * NULL values will not compare equal even if SQL_NULLEQ is set on > > * OP_Ne or OP_Eq. > > */ Diff: diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index 116194fae..e07ff1be9 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -855,7 +855,7 @@ case OP_String: { /* out2 */ * is less than P2 (typically P3 is zero) then only register P2 is * set to NULL. * - * If the P1 value is non-zero, then also set the Cleared flag so that + * If the P1 value is non-zero, then also set the MEM_Cleared flag so that * NULL values will not compare equal even if SQL_NULLEQ is set on * OP_Ne or OP_Eq. */ New patch: commit 56565414c4f332d5711d458b3896016d972c1f9c Author: Mergen Imeev Date: Tue Mar 16 15:14:32 2021 +0300 sql: introduce mem_set_null_clear() This patch introduces mem_set_null_clear() function. This function sets "cleared" NULL to MEM. This NULL is used only in internal VDBE operations. Part of #5818 diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index 172883a44..3930067e1 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -485,6 +485,13 @@ mem_set_agg(struct Mem *mem, struct func *func, int size) return 0; } +void +mem_set_null_clear(struct Mem *mem) +{ + mem_clear(mem); + mem->flags = MEM_Null | MEM_Cleared; +} + int mem_copy(struct Mem *to, const struct Mem *from) { diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h index 6dee83dc5..9890762e0 100644 --- a/src/box/sql/mem.h +++ b/src/box/sql/mem.h @@ -553,6 +553,10 @@ mem_set_frame(struct Mem *mem, struct VdbeFrame *frame); int mem_set_agg(struct Mem *mem, struct func *func, int size); +/** Clear MEM and set it to special, "cleared", NULL. */ +void +mem_set_null_clear(struct Mem *mem); + /** * Copy content of MEM from one MEM to another. In case source MEM contains * string or binary and allocation type is not STATIC, this value is copied to diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c index d5b8033a4..e07ff1be9 100644 --- a/src/box/sql/vdbe.c +++ b/src/box/sql/vdbe.c @@ -865,13 +865,14 @@ case OP_Null: { /* out2 */ cnt = pOp->p3-pOp->p2; assert(pOp->p3<=(p->nMem+1 - p->nCursor)); if (pOp->p1 != 0) - pOut->flags = MEM_Null | MEM_Cleared; + mem_set_null_clear(pOut); while( cnt>0) { pOut++; memAboutToChange(p, pOut); - mem_set_null(pOut); if (pOp->p1 != 0) - pOut->flags = MEM_Null | MEM_Cleared; + mem_set_null_clear(pOut); + else + mem_set_null(pOut); cnt--; } break;