Tarantool development patches archive
 help / color / mirror / Atom feed
From: "n.pettik" <korablev@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 3/8] sql: remove numeric affinity
Date: Fri, 1 Feb 2019 19:39:17 +0300	[thread overview]
Message-ID: <E85FA3B4-79EF-4D61-9D53-E9A57CC1C1DA@tarantool.org> (raw)
In-Reply-To: <3f72dcc1-0a98-908e-ae1f-f603758d4129@tarantool.org>


>>>>>> diff --git a/src/box/sql.c b/src/box/sql.c
>>>>>> index a06c50dca..a498cd8fe 100644
>>>>>> --- a/src/box/sql.c
>>>>>> +++ b/src/box/sql.c
>>>>>> @@ -376,14 +376,18 @@ sql_ephemeral_space_create(uint32_t field_count, struct sql_key_info *key_info)
>>>>>> for (uint32_t i = 0; i < field_count; ++i) {
>>>>>> struct key_part_def *part = &ephemer_key_parts[i];
>>>>>> part->fieldno = i;
>>>>>> -part->type = FIELD_TYPE_SCALAR;
>>>>>> part->nullable_action = ON_CONFLICT_ACTION_NONE;
>>>>>> part->is_nullable = true;
>>>>>> part->sort_order = SORT_ORDER_ASC;
>>>>>> -if (def != NULL && i < def->part_count)
>>>>>> +if (def != NULL && i < def->part_count) {
>>>>>> +assert(def->parts[i].type < field_type_MAX);
>>>>>> +part->type = def->parts[i].type != FIELD_TYPE_ANY ?
>>>>>> +    def->parts[i].type : FIELD_TYPE_SCALAR;
>>>>>> part->coll_id = def->parts[i].coll_id;
>>>>> 
>>>>> 1. How can key_part have FIELD_TYPE_ANY? We have no comparators for ANY
>>>>> type, it is impossible, isn't it?
>>>> We don’t, and that is why I replace ANY with SCALAR.
>>> 
>>> No, you still check for "def->parts[i].type != FIELD_TYPE_ANY", and I
>>> can not understand how is it possible. struct key_def can not have
>>> FIELD_TYPE_ANY in its parts.
>> Now this problem is fixed in the next patches.
>> In this one it can’t be fixed with ease.
> 
> What a problem can not be fixed? I did this:
> 
> diff --git a/src/box/sql.c b/src/box/sql.c
> index 530ec2384..f53600837 100644
> --- a/src/box/sql.c
> +++ b/src/box/sql.c
> @@ -387,8 +387,7 @@ sql_ephemeral_space_create(uint32_t field_count, struct sql_key_info *key_info)
> 		part->sort_order = SORT_ORDER_ASC;
> 		if (def != NULL && i < def->part_count) {
> 			assert(def->parts[i].type < field_type_MAX);
> -			part->type = def->parts[i].type != FIELD_TYPE_ANY ?
> -				     def->parts[i].type : FIELD_TYPE_SCALAR;
> +			part->type = def->parts[i].type;
> 			part->coll_id = def->parts[i].coll_id;
> 		} else {
> 			part->coll_id = COLL_NONE;
> 
> And no test failed. This is because, as I said, key_part.type
> is never ever can be ANY. I was not talking above about ANY
> removal from all places, but from this particular one. And here
> we can be sure, that key_part.type != FIELD_TYPE_ANY always.
> 
> Please, apply this.

Ok. I've understood that it can't be of type ANY due to
the fact that sql_affinity_to_field_type (which is used to init sql_key_info)
never returns ANY and default value is SCALAR.

Applied.

  reply	other threads:[~2019-02-01 16:39 UTC|newest]

Thread overview: 48+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-28  9:34 [tarantool-patches] [PATCH 0/8] Eliminate affinity from source code Nikita Pettik
2018-12-28  9:34 ` [tarantool-patches] [PATCH 1/8] sql: remove SQLITE_ENABLE_UPDATE_DELETE_LIMIT define Nikita Pettik
2018-12-29 17:42   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 14:25     ` n.pettik
2018-12-28  9:34 ` [tarantool-patches] [PATCH 2/8] sql: use field type instead of affinity for type_def Nikita Pettik
2018-12-29 17:42   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 14:26     ` n.pettik
2018-12-28  9:34 ` [tarantool-patches] [PATCH 3/8] sql: remove numeric affinity Nikita Pettik
2018-12-29  9:01   ` [tarantool-patches] " Konstantin Osipov
2018-12-29 17:42   ` Vladislav Shpilevoy
2019-01-09  8:26     ` Konstantin Osipov
2019-01-16 14:26     ` n.pettik
2019-01-22 15:41       ` Vladislav Shpilevoy
2019-01-28 16:39         ` n.pettik
2019-01-30 13:04           ` Vladislav Shpilevoy
2019-02-01 16:39             ` n.pettik [this message]
2019-01-09  8:20   ` Konstantin Osipov
2018-12-28  9:34 ` [tarantool-patches] [PATCH 4/8] sql: replace affinity with field type for func Nikita Pettik
2018-12-28  9:34 ` [tarantool-patches] [PATCH 5/8] sql: replace field type with affinity for VDBE runtime Nikita Pettik
2018-12-29 17:42   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 14:26     ` n.pettik
2019-01-22 15:41       ` Vladislav Shpilevoy
2019-01-28 16:39         ` n.pettik
2019-01-30 13:04           ` Vladislav Shpilevoy
2019-02-01 16:39             ` n.pettik
2019-02-05 15:08               ` Vladislav Shpilevoy
2019-02-05 17:46                 ` n.pettik
2018-12-28  9:34 ` [tarantool-patches] [PATCH 6/8] sql: replace affinity with field type in struct Expr Nikita Pettik
2018-12-29 17:42   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 14:26     ` n.pettik
2019-01-22 15:41       ` Vladislav Shpilevoy
2019-01-28 16:39         ` n.pettik
2019-01-30 13:04           ` Vladislav Shpilevoy
2019-02-01 16:39             ` n.pettik
2019-02-05 15:08               ` Vladislav Shpilevoy
2019-02-05 17:46                 ` n.pettik
2018-12-28  9:34 ` [tarantool-patches] [PATCH 7/8] sql: clean-up affinity from SQL source code Nikita Pettik
2018-12-29 17:42   ` [tarantool-patches] " Vladislav Shpilevoy
2019-01-16 14:26     ` n.pettik
2019-01-22 15:41       ` Vladislav Shpilevoy
2019-01-28 16:40         ` n.pettik
2019-01-30 13:04           ` Vladislav Shpilevoy
2019-02-01 16:39             ` n.pettik
2019-02-05 15:08               ` Vladislav Shpilevoy
2019-02-05 17:46                 ` n.pettik
2018-12-28  9:34 ` [tarantool-patches] [PATCH 8/8] Remove affinity from field definition Nikita Pettik
2019-02-05 19:41 ` [tarantool-patches] Re: [PATCH 0/8] Eliminate affinity from source code Vladislav Shpilevoy
2019-02-08 13:37 ` 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=E85FA3B4-79EF-4D61-9D53-E9A57CC1C1DA@tarantool.org \
    --to=korablev@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='[tarantool-patches] Re: [PATCH 3/8] sql: remove numeric affinity' \
    /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