Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>,
	tarantool-patches@freelists.org
Subject: [tarantool-patches] Re: [PATCH v4 4/7] sql: start using collations and is_nullable from space_def
Date: Thu, 3 May 2018 13:21:06 +0300	[thread overview]
Message-ID: <c030b995-c125-f221-ab2c-ca94096b8900@tarantool.org> (raw)
In-Reply-To: <678424f1af156eb26d13ac58a2ed4befae0f98fd.1524939874.git.kshcherbatov@tarantool.org>

Hello. See 5 comments below.

On 28/04/2018 21:26, Kirill Shcherbatov wrote:
> Part of #3272.
> ---
>   src/box/sql.c           | 36 +++++++++++++++++++++++++-----------
>   src/box/sql/alter.c     | 11 ++++++++---
>   src/box/sql/build.c     | 20 +++++++++++++-------
>   src/box/sql/fkey.c      |  7 ++-----
>   src/box/sql/select.c    |  6 ++++--
>   src/box/sql/sqliteInt.h |  7 -------
>   src/box/sql/vdbeaux.c   |  5 ++++-
>   7 files changed, 56 insertions(+), 36 deletions(-)
> 
> diff --git a/src/box/sql.c b/src/box/sql.c
> index 2893d70..ef11eb9 100644
> --- a/src/box/sql.c
> +++ b/src/box/sql.c
> @@ -1449,7 +1449,9 @@ int tarantoolSqlite3MakeTableFormat(Table *pTable, void *buf)
>   
>   	for (i = 0; i < n; i++) {
>   		const char *t;
> -		struct coll *coll = aCol[i].coll;
> +		struct coll *coll =
> +			coll_by_id(pTable->def->fields[i].coll_id);
> +
>   		struct field_def *field = &def->fields[i];
>   		const char *zToken = field->default_value;
>   		int base_len = 4;
> @@ -1461,19 +1463,25 @@ int tarantoolSqlite3MakeTableFormat(Table *pTable, void *buf)
>   		p = enc->encode_str(p, "name", 4);
>   		p = enc->encode_str(p, field->name, strlen(field->name));
>   		p = enc->encode_str(p, "type", 4);
> +
> +		assert(def->fields[i].is_nullable ==
> +		       (def->fields[i].nullable_action ==
> +			ON_CONFLICT_ACTION_NONE));

1. AFAIR I asked you to wrap this check into a function.
> diff --git a/src/box/sql/alter.c b/src/box/sql/alter.c
> index bedf602..f830a15 100644
> --- a/src/box/sql/alter.c
> +++ b/src/box/sql/alter.c
> @@ -307,9 +312,9 @@ sqlite3AlterBeginAddColumn(Parse * pParse, SrcList * pSrc)
>   	}
>   	memcpy(pNew->aCol, pTab->aCol, sizeof(Column) * pNew->def->field_count);
>   	for (i = 0; i < pNew->def->field_count; i++) {
> -		Column *pCol = &pNew->aCol[i];
> +		/* FIXME: Column *pCol = &pNew->aCol[i]; */

2. Why FIXME ?
> diff --git a/src/box/sql/fkey.c b/src/box/sql/fkey.c
> index c15ad8c..8c015c9 100644
> --- a/src/box/sql/fkey.c
> +++ b/src/box/sql/fkey.c
> @@ -34,6 +34,7 @@
>    * support to compiled SQL statements.
>    */
>   #include <box/coll.h>
> +#include "box/coll_cache.h"

3. Why? It is not used here.
> @@ -535,11 +536,7 @@ exprTableRegister(Parse * pParse,	/* Parsing and code generating context */
>   			pCol = &pTab->aCol[iCol];
>   			pExpr->iTable = regBase + iCol + 1;
>   			pExpr->affinity = pCol->affinity;
> -			const char *coll_name;
> -			if (pCol->coll == NULL && pCol->coll != NULL)
> -				coll_name = pCol->coll->name;
> -			else
> -				coll_name = "binary";
> +			const char *coll_name = "binary";
>   			pExpr = sqlite3ExprAddCollateString(pParse, pExpr,
>   							    coll_name);

4. Why you did not just inline "binary" string ?
> diff --git a/src/box/sql/select.c b/src/box/sql/select.c
> index 03bfcf9..fa1de9b 100644
> --- a/src/box/sql/select.c
> +++ b/src/box/sql/select.c
> @@ -1836,6 +1836,8 @@ sqlite3ColumnsFromExprList(Parse * pParse,	/* Parsing context */
>   	pTable->def->fields =
>   		region_alloc(region, nCol*sizeof(pTable->def->fields[0]));
>   	memset(pTable->def->fields, 0, nCol*sizeof(pTable->def->fields[0]));
> +	for (int i = 0; i < nCol; i++)
> +		pTable->def->fields[i].is_nullable = true;

5. Why?

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

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-04-25 16:52 [tarantool-patches] [PATCH v3 0/4] sql: Removed Column fields to server with region allocations Kirill Shcherbatov
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 1/4] sql: Fix code style in sqlite3Pragma Kirill Shcherbatov
2018-04-26 11:47   ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 2/4] sql: Remove zName and nColumn from SQL Kirill Shcherbatov
2018-04-25 17:10   ` [tarantool-patches] " Kirill Shcherbatov
2018-04-26 12:12     ` Vladislav Shpilevoy
2018-04-26 11:47   ` Vladislav Shpilevoy
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 3/4] sql: Removed type " Kirill Shcherbatov
2018-04-25 16:52 ` [tarantool-patches] [PATCH v3 4/4] sql: Region-based allocations Kirill Shcherbatov
2018-04-26 11:47   ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-26 11:47 ` [tarantool-patches] Re: [PATCH v3 0/4] sql: Removed Column fields to server with region allocations Vladislav Shpilevoy
2018-04-28 18:26 ` [tarantool-patches] [PATCH v4 0/7] sql: refactor SQL Parser structures Kirill Shcherbatov
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 1/7] sql: fix code style in sqlite3Pragma Kirill Shcherbatov
2018-05-03 10:10     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 2/7] sql: remove zName and nColumn from SQL Kirill Shcherbatov
2018-05-03 10:10     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 3/7] sql: start using type from space_def Kirill Shcherbatov
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 4/7] sql: start using collations and is_nullable " Kirill Shcherbatov
2018-05-03 10:21     ` Vladislav Shpilevoy [this message]
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 5/7] sql: move names to server Kirill Shcherbatov
2018-05-03 11:08     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 6/7] sql: start using is_view field from space_def Kirill Shcherbatov
2018-05-03 11:16     ` [tarantool-patches] " Vladislav Shpilevoy
2018-04-28 18:26   ` [tarantool-patches] [PATCH v4 7/7] sql: space_def* instead of Table* in Expr Kirill Shcherbatov
2018-05-03 11:32     ` [tarantool-patches] " Vladislav Shpilevoy
2018-05-03 10:10   ` [tarantool-patches] Re: [PATCH v4 0/7] sql: refactor SQL Parser structures Vladislav Shpilevoy

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=c030b995-c125-f221-ab2c-ca94096b8900@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v4 4/7] sql: start using collations and is_nullable from space_def' \
    /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