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 1A7D327015 for ; Fri, 1 Feb 2019 11:39:19 -0500 (EST) 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 hP0E6IuF49Cv for ; Fri, 1 Feb 2019 11:39:19 -0500 (EST) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (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 CACC123EBA for ; Fri, 1 Feb 2019 11:39:18 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH 3/8] sql: remove numeric affinity From: "n.pettik" In-Reply-To: <3f72dcc1-0a98-908e-ae1f-f603758d4129@tarantool.org> Date: Fri, 1 Feb 2019 19:39:17 +0300 Content-Transfer-Encoding: quoted-printable Message-Id: References: <58b4d75729413f02134c72886ecbc749e510a1d1.1545987214.git.korablev@tarantool.org> <28e6da44-2d1e-87b5-741d-a791750db6c4@tarantool.org> <3f72dcc1-0a98-908e-ae1f-f603758d4129@tarantool.org> 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: tarantool-patches@freelists.org Cc: Vladislav Shpilevoy >>>>>> 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 =3D 0; i < field_count; ++i) { >>>>>> struct key_part_def *part =3D &ephemer_key_parts[i]; >>>>>> part->fieldno =3D i; >>>>>> -part->type =3D FIELD_TYPE_SCALAR; >>>>>> part->nullable_action =3D ON_CONFLICT_ACTION_NONE; >>>>>> part->is_nullable =3D true; >>>>>> part->sort_order =3D SORT_ORDER_ASC; >>>>>> -if (def !=3D NULL && i < def->part_count) >>>>>> +if (def !=3D NULL && i < def->part_count) { >>>>>> +assert(def->parts[i].type < field_type_MAX); >>>>>> +part->type =3D def->parts[i].type !=3D FIELD_TYPE_ANY ? >>>>>> + def->parts[i].type : FIELD_TYPE_SCALAR; >>>>>> part->coll_id =3D def->parts[i].coll_id; >>>>>=20 >>>>> 1. How can key_part have FIELD_TYPE_ANY? We have no comparators = for ANY >>>>> type, it is impossible, isn't it? >>>> We don=E2=80=99t, and that is why I replace ANY with SCALAR. >>>=20 >>> No, you still check for "def->parts[i].type !=3D 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=E2=80=99t be fixed with ease. >=20 > What a problem can not be fixed? I did this: >=20 > 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 =3D SORT_ORDER_ASC; > if (def !=3D NULL && i < def->part_count) { > assert(def->parts[i].type < field_type_MAX); > - part->type =3D def->parts[i].type !=3D = FIELD_TYPE_ANY ? > - def->parts[i].type : = FIELD_TYPE_SCALAR; > + part->type =3D def->parts[i].type; > part->coll_id =3D def->parts[i].coll_id; > } else { > part->coll_id =3D COLL_NONE; >=20 > 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 !=3D FIELD_TYPE_ANY always. >=20 > 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.