From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id BF7822D7DE for ; Sun, 26 May 2019 05:45:03 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id VHjitDFInvEN for ; Sun, 26 May 2019 05:45:03 -0400 (EDT) Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 6A5FF2D7D6 for ; Sun, 26 May 2019 05:45:03 -0400 (EDT) Date: Sun, 26 May 2019 12:45:00 +0300 From: Mergen Imeev Subject: [tarantool-patches] Re: [PATCH v1 06/21] sql: remove SQL_NOTFOUND error/status code Message-ID: <20190526094500.GB20428@tarantool.org> References: <4E2824A4-6F08-4539-9954-EF9783217D54@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <4E2824A4-6F08-4539-9954-EF9783217D54@tarantool.org> Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: "n.pettik" Cc: tarantool-patches@freelists.org On Sat, May 25, 2019 at 05:58:19PM +0300, n.pettik wrote: > > > > On 25 May 2019, at 13:44, imeevma@tarantool.org wrote: > > > > Removing this error/status code is part of getting rid of the SQL > > error system. > > --- > > src/box/sql/os_unix.c | 2 +- > > src/box/sql/sqlInt.h | 2 -- > > src/box/sql/where.c | 13 ++----------- > > 3 files changed, 3 insertions(+), 14 deletions(-) > > > > diff --git a/src/box/sql/where.c b/src/box/sql/where.c > > index 0b1ccd9..060dfee 100644 > > --- a/src/box/sql/where.c > > +++ b/src/box/sql/where.c > > @@ -1528,21 +1528,14 @@ whereEqualScanEst(Parse * pParse, /* Parsing & code generating context */ > > assert(nEq >= 1); > > assert(nEq <= (int) p->key_def->part_count); > > assert(pBuilder->nRecValid < nEq); > > - > > - /* If values are not available for all fields of the index to the left > > - * of this one, no estimate can be made. Return SQL_NOTFOUND. > > - */ > > - if (pBuilder->nRecValid < (nEq - 1)) { > > - return SQL_NOTFOUND; > > - } > > + assert(pBuilder->nRecValid >= (nEq - 1)); > > Taking into consideration assert above, it could > be replaced with assert(pBuilder->nRecValid == nEq - 1); Fixed. diff --git a/src/box/sql/where.c b/src/box/sql/where.c index 060dfee..81a2739 100644 --- a/src/box/sql/where.c +++ b/src/box/sql/where.c @@ -1527,8 +1527,7 @@ whereEqualScanEst(Parse * pParse, /* Parsing & code generating context */ assert(nEq >= 1); assert(nEq <= (int) p->key_def->part_count); - assert(pBuilder->nRecValid < nEq); - assert(pBuilder->nRecValid >= (nEq - 1)); + assert(pBuilder->nRecValid == (nEq - 1)); rc = sqlStat4ProbeSetValue(pParse, p, &pRec, pExpr, 1, nEq - 1, &bOk); > Btw, this function doesn’t seem to be called at all: > unreachable() assert doesn’t fire. I can assume that it is > connected with stat tables. > I think that we do not have the right way to check this, so I think that we will either enable or delete this function when the statistics table is created.