[tarantool-patches] Re: [PATCH] sql: remove nKey from struct BtCursor

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Mon Oct 29 13:27:45 MSK 2018


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




More information about the Tarantool-patches mailing list