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 E68D22B7DD for ; Mon, 29 Oct 2018 06:27:47 -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 NFE-yonY7XHn for ; Mon, 29 Oct 2018 06:27:47 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (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 A5D5B2B60F for ; Mon, 29 Oct 2018 06:27:47 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH] sql: remove nKey from struct BtCursor References: <20181026145926.15345-1-korablev@tarantool.org> From: Vladislav Shpilevoy Message-ID: <64674871-e5f0-0cb2-540c-d95cfce47409@tarantool.org> Date: Mon, 29 Oct 2018 13:27:45 +0300 MIME-Version: 1.0 In-Reply-To: <20181026145926.15345-1-korablev@tarantool.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit 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: Nikita Pettik , tarantool-patches@freelists.org Hi! Thanks for the patch! Consider my review fixes and the end of the email. Why are you sure that nKey is always 0? As I see in the code, it is initialized in tarantoolSqlite3MovetoUnpacked as sqlite3VdbeMsgpackRecordLen. How does COUNT work, when you specify WHERE? For example, SELECT COUNT(*) WHERE key_column = ;. Looks like it can be effectively forwarded to index_count(). =================================================== diff --git a/src/box/sql.c b/src/box/sql.c index 9d58b8fcf..9aca618ce 100644 --- a/src/box/sql.c +++ b/src/box/sql.c @@ -340,7 +340,7 @@ int tarantoolSqlite3EphemeralCount(struct BtCursor *pCur, i64 *pnEntry) assert(pCur->curFlags & BTCF_TEphemCursor); struct index *primary_index = space_index(pCur->space, 0 /* PK */); - *pnEntry = index_count(primary_index, pCur->iter_type, 0, 0); + *pnEntry = index_count(primary_index, pCur->iter_type, NULL, 0); return SQLITE_OK; } @@ -348,7 +348,7 @@ int tarantoolSqlite3Count(BtCursor *pCur, i64 *pnEntry) { assert(pCur->curFlags & BTCF_TaCursor); - *pnEntry = index_count(pCur->index, pCur->iter_type, 0, 0); + *pnEntry = index_count(pCur->index, pCur->iter_type, NULL, 0); return SQLITE_OK; }