From: Nikita Pettik <korablev@tarantool.org>
To: Mergen Imeev <imeevma@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v1 1/1] sql: allow to convert big real values to integer
Date: Thu, 5 Dec 2019 15:36:06 +0300 [thread overview]
Message-ID: <20191205123606.GC15510@tarantool.org> (raw)
In-Reply-To: <20191123114805.GA18119@tarantool.org>
On 23 Nov 14:48, Mergen Imeev wrote:
> > BTW below I see path which is executed when
> > is_forced == false. And it is also about same wrong conversion. Please
> > check it as well and add test case.
> >
> I found that is_forced variable did nothing it this code.
> Removed it from code along with "if" checked it.
If it is unused, please move this refactoring to a separate patch.
> diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
> index ab86be9..450e21d 100644
> --- a/src/box/sql/vdbe.c
> +++ b/src/box/sql/vdbe.c
> @@ -322,13 +322,16 @@ mem_apply_type(struct Mem *record, enum field_type type)
> if ((record->flags & MEM_UInt) == MEM_UInt)
> return 0;
> if ((record->flags & MEM_Real) == MEM_Real) {
> - int64_t i = (int64_t) record->u.r;
> - if (i == record->u.r)
> - mem_set_int(record, record->u.r,
> - record->u.r <= -1);
> + double d = record->u.r;
> + int64_t i = (int64_t) d;
> + uint64_t u = (uint64_t) d;
> + if (i == d)
> + mem_set_int(record, d, d <= -1);
Nit: mem_set_int(record, i, i <= -1;);
> + else if (u == d)
> + mem_set_u64(record, d);
Nit: mem_set_u64(record, u);
prev parent reply other threads:[~2019-12-05 12:36 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-11-05 17:42 imeevma
2019-11-21 1:19 ` Nikita Pettik
2019-11-23 11:48 ` Mergen Imeev
2019-12-05 12:36 ` Nikita Pettik [this message]
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=20191205123606.GC15510@tarantool.org \
--to=korablev@tarantool.org \
--cc=imeevma@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v1 1/1] sql: allow to convert big real values to integer' \
/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