From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: tarantool-patches@freelists.org,
"n.pettik" <korablev@tarantool.org>,
Kirill Yukhin <kyukhin@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH 2/2] sql: don't change type of function's retval after codegen
Date: Thu, 21 Mar 2019 17:46:51 +0300 [thread overview]
Message-ID: <6f9d3175-4b2a-af07-79ad-e017e33fce09@tarantool.org> (raw)
In-Reply-To: <72283387-1BD8-420F-BBF7-8B516ADC1675@tarantool.org>
On 21/03/2019 15:51, n.pettik wrote:
>
>> On 11/03/2019 21:10, Nikita Pettik wrote:
>>> Proper type of function's returning value is set during names resolution
>>> (i.e. promotion from struct FuncDef to struct Expr, see
>>> resolveExprStep()). Accidentally, it was set again during byte-code
>>> generation for VDBE. What is more, in some cases it was set to a wrong
>>> type. For instance, built-in function randomblob() returns value to be
>>> encoded as MP_BIN, so its returning type is SCALAR. However, it was
>>> reset to INTEGER (as its first argument). This patch simply removes this
>>> second type promotion.
>>> ---
>>> src/box/sql/expr.c | 11 -----------
>>> test/sql/iproto.result | 41 +++++++++++++++++++++++++++++++++++++++++
>>> test/sql/iproto.test.lua | 15 +++++++++++++++
>>> 3 files changed, 56 insertions(+), 11 deletions(-)
>>> diff --git a/test/sql/iproto.result b/test/sql/iproto.result
>>> index 3a77c8e93..26d55b60c 100644
>>> --- a/test/sql/iproto.result
>>> +++ b/test/sql/iproto.result
>>> +-- Type set during compilation stage, and since min/max are accept
>>> +-- arguments of all scalar type, we can't say nothing more than
>>> +-- SCALAR.
>>> +--
>>> +cn:execute("SELECT min(1, 2, 3);")
>>> +---
>>> +- metadata:
>>> + - name: min(1, 2, 3)
>>> + type: scalar
>>
>> This is the case, when a first argument type would be ok. As I
>> understand, it is illegal to calculate min of multiple different
>> types, so its rettype should be equal to its first argument. It
>> is not?
>
> Unfortunately, it is legal:
>
> tarantool> SELECT min('abc', 1);
> ---
> - - [1]
> …
>
> It is to be resolved in scope of this issue:
> https://github.com/tarantool/tarantool/issues/4032
>
>
Thanks for the patchset and the explanations! As I see, Kostja
is ok with your type name changes. Technically the patch LGTM.
next prev parent reply other threads:[~2019-03-21 14:46 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-11 18:10 [tarantool-patches] [PATCH 0/2] SQL types fixes Nikita Pettik
2019-03-11 18:10 ` [tarantool-patches] [PATCH 1/2] sql: make type in column-meta be consistent with NoSQL names Nikita Pettik
2019-03-21 9:03 ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-21 14:00 ` Konstantin Osipov
2019-03-11 18:10 ` [tarantool-patches] [PATCH 2/2] sql: don't change type of function's retval after codegen Nikita Pettik
2019-03-21 9:03 ` [tarantool-patches] " Vladislav Shpilevoy
2019-03-21 12:51 ` n.pettik
2019-03-21 14:46 ` Vladislav Shpilevoy [this message]
2019-04-03 7:58 ` [tarantool-patches] Re: [PATCH 0/2] SQL types fixes 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=6f9d3175-4b2a-af07-79ad-e017e33fce09@tarantool.org \
--to=v.shpilevoy@tarantool.org \
--cc=korablev@tarantool.org \
--cc=kyukhin@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH 2/2] sql: don'\''t change type of function'\''s retval after codegen' \
/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