Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Nikita Pettik <korablev@tarantool.org>, tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH] sql: remove nKey from struct BtCursor
Date: Mon, 29 Oct 2018 13:27:45 +0300	[thread overview]
Message-ID: <64674871-e5f0-0cb2-540c-d95cfce47409@tarantool.org> (raw)
In-Reply-To: <20181026145926.15345-1-korablev@tarantool.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 = <key_value>;. Looks like
it can be effectively forwarded to index_count(<key_value>).

===================================================

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;
  }

  reply	other threads:[~2018-10-29 10:27 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-10-26 14:59 [tarantool-patches] " Nikita Pettik
2018-10-29 10:27 ` Vladislav Shpilevoy [this message]
2018-10-29 12:25   ` [tarantool-patches] " n.pettik
2018-10-29 12:39     ` Vladislav Shpilevoy
2018-11-01 14:50 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=64674871-e5f0-0cb2-540c-d95cfce47409@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH] sql: remove nKey from struct BtCursor' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox