From: Nikita Pettik <korablev@tarantool.org>
To: Mergen Imeev <imeevma@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v3 2/8] sql: change implicit cast for assignment
Date: Tue, 7 Jul 2020 15:35:55 +0000 [thread overview]
Message-ID: <20200707153555.GA26461@tarantool.org> (raw)
In-Reply-To: <5bbf04dc-addd-f188-f371-fba854f0a468@tarantool.org>
On 07 Jul 12:29, Mergen Imeev wrote:
>
> On 07.07.2020 00:27, Nikita Pettik wrote:
> > On 05 Jul 17:26, Mergen Imeev wrote:
> > > Hi! Thank you for the review. My answers and new patch
> > > below. Sorry, I didn't include diff.
> > > > > commit 21d7145c1929bc4606c56e9a566477f248637ed1
> > > > > Author: Mergen Imeev <imeevma@gmail.com>
> > > > > Date: Wed May 27 13:49:11 2020 +0300
> > > > >
> > > > > + if (field_mp_plain_type_is_compatible(type, mp_type, true))
> > > > > + return 0;
> > > > > + return -1;
> > > > > +}
> > > > > +
> > > > > +/**
> > > > > + * Convert the numeric value contained in MEM to double. If the
> > > > > + * is_precise flag is set, the conversion will succeed only if it
> > > > > + * is lossless.
> > > > > + *
> > > > > + * @param mem The MEM that contains the numeric value.
> > > > > + * @param is_precise Flag.
> > > > > + * @retval 0 if the conversion was successful, -1 otherwise.
> > > > > + */
> > > > > +static int
> > > > > +mem_convert_to_double(struct Mem *mem, bool is_precise)
> > > > > +{
> > > > > + if ((mem->flags & (MEM_Int | MEM_UInt)) == 0)
> > > > > + return -1;
> > > > > + if ((mem->flags & MEM_Int) != 0) {
> > > > > + int64_t i = mem->u.i;
> > > > > + double d = (double)i;
> > > > > + if (!is_precise || i == (int64_t)d)
> > > > > + mem_set_double(mem, d);
> > > > > + else
> > > > > + return -1;
> > > > > + } else {
> > > > > + uint64_t u = mem->u.u;
> > > > > + double d = (double)u;
> > > > > + if (!is_precise || u == (uint64_t)d)
> > > > > + mem_set_double(mem, d);
> > > > > + else
> > > > > + return -1;
> > > > > + }
> > > > > + mem->field_type = FIELD_TYPE_DOUBLE;
> > > > Why not incorparate field_type assingment into mem_set_double()?
> > > > The same concerns other converting functions.
> > > >
> > > I think this should be done in #4906 issue since it may
> > > lead to not always simple to understand changes.
> > Эм, не очень понял как трактовать твой ответ. Типо тут работает,
> > а если там засунуть, то что-то начинает падать..? 4906 немного про
> > другое: в любом случае у нас в меме будет и field_type и mp_type.
> > К тому же, и то, и это - рефакторинг и функциональных изменений быть
> > не должно.
> Не уверен, что это чистый рефакторинг, т.к. точно помны возникала
> проблема с тем, что MEM_type мог быть не совместимым с field_type
> т.к. field_type не изменился при переписывании мема.
>
> Стоит сделать это изменение для mem_set_* отдельным тикетом?
Тикетом, патчем, фолоу-апом - как хочешь.
next prev parent reply other threads:[~2020-07-07 15:35 UTC|newest]
Thread overview: 32+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-25 15:17 [Tarantool-patches] [PATCH v3 0/8] Remove implicit cast imeevma
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 1/8] sql: introduce mem_set_double() imeevma
2020-06-28 13:31 ` Nikita Pettik
2020-07-06 14:02 ` Nikita Pettik
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 2/8] sql: change implicit cast for assignment imeevma
2020-06-30 11:50 ` Nikita Pettik
2020-07-05 14:26 ` Mergen Imeev
2020-07-06 21:27 ` Nikita Pettik
2020-07-07 9:29 ` Mergen Imeev
2020-07-07 15:35 ` Nikita Pettik [this message]
2020-07-10 10:49 ` Nikita Pettik
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 3/8] sql: remove mem_apply_type() from OP_MakeRecord imeevma
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 4/8] sql: replace ApplyType by CheckType for IN operator imeevma
2020-06-29 12:56 ` Nikita Pettik
2020-07-05 14:28 ` Mergen Imeev
2020-07-06 22:06 ` Nikita Pettik
2020-07-07 11:26 ` Mergen Imeev
2020-07-07 16:29 ` Nikita Pettik
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 5/8] sql: remove mem_apply_type() from OP_MustBeInt imeevma
2020-06-29 13:29 ` Nikita Pettik
2020-07-05 14:29 ` Mergen Imeev
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 6/8] sql: remove implicit cast for comparison imeevma
2020-06-29 23:51 ` Nikita Pettik
2020-07-05 14:47 ` Mergen Imeev
2020-07-06 23:11 ` Nikita Pettik
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 7/8] sql: remove unused functions imeevma
2020-06-29 23:52 ` Nikita Pettik
2020-07-05 14:50 ` Mergen Imeev
2020-06-25 15:17 ` [Tarantool-patches] [PATCH v3 8/8] sql: show value and its type in type mismatch error imeevma
2020-06-30 0:22 ` Nikita Pettik
2020-07-05 15:03 ` Mergen Imeev
2020-07-06 21:44 ` Nikita Pettik
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=20200707153555.GA26461@tarantool.org \
--to=korablev@tarantool.org \
--cc=imeevma@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v3 2/8] sql: change implicit cast for assignment' \
/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