Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
To: imeevma@tarantool.org, tsafin@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 04/10] box: add new options for functions
Date: Sat, 22 Aug 2020 16:28:53 +0200	[thread overview]
Message-ID: <b0ede159-64da-a6a8-572d-ea1eb219462f@tarantool.org> (raw)
In-Reply-To: <65c71dc224b0365954c396486c87738fb9ca5baf.1597417321.git.imeevma@gmail.com>

Thanks for the patch!

On 14.08.2020 17:04, imeevma@tarantool.org wrote:
> The has_vararg option allows us to work with functions with a variable
> number of arguments. This is required for built-in SQL functions.
> 
> Suppose this option is TRUE for a built-in SQL function. Then:
> 1) If param_list is empty, all arguments can be of any type.
> 2) If the length of param_list is not less than the number of the given
> arguments, the types of the given arguments must be compatible with the
> corresponding types described in param_list.
> 3) If the length of param_list is less than the number of given
> arguments, the rest of the arguments must be compatible with the last
> type in param_list.

How is it going to be used? For example, how will it work with printf(),
where tail of the arguments can be of any type? Do you define it as
scalar then?

> The is_overloaded option allows us to deal with functions that can take
> STRING or VARBINARY arguments. In case the first of these arguments is
> of type VARBINARY, we use the overloaded version of the function. By
> default, we use the STRING version of the function.
> 
> The has_overload option indicates that the function has an overloaded
> version that accepts VARBINARY. See an explanation of the is_overloaded
> option.

In addition to this whole idea with overloads being a huge crutch which also
affects the public API with adding some new intricate options, it also looks
like has_overload is entirely a runtime option. Why is it even stored in
_func?

What if I have a function taking STRING, and I want to add VARBINARY, I
need to update 2 records in _func for that? Looks really inconvenient.

I would try to think more into how not to store these options in _func. Because
you are trying to describe some code from the executable's file using the
storage. From there most of the problems arise - new complicated options for
_func, hard upgrade process, and unnecessary changes of the schema.

Why can't you specify all these flags inside sql_builtins array, and
copy them into func_def from there? It already works fine this way.

  reply	other threads:[~2020-08-22 14:28 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-14 15:04 [Tarantool-patches] [PATCH v2 00/10] sql: properly check arguments types of built-in functions imeevma
2020-08-14 15:04 ` [Tarantool-patches] [PATCH v2 01/10] sql: do not return UNSIGNED in " imeevma
2020-08-22 14:23   ` Vladislav Shpilevoy
2020-08-14 15:04 ` [Tarantool-patches] [PATCH v2 02/10] sql: fix functions return types imeevma
2020-08-22 14:24   ` Vladislav Shpilevoy
2020-08-14 15:04 ` [Tarantool-patches] [PATCH v2 03/10] sql: change signature of trim() imeevma
2020-08-22 14:26   ` Vladislav Shpilevoy
2020-08-14 15:04 ` [Tarantool-patches] [PATCH v2 04/10] box: add new options for functions imeevma
2020-08-22 14:28   ` Vladislav Shpilevoy [this message]
2020-08-14 15:05 ` [Tarantool-patches] [PATCH v2 05/10] sql: use has_vararg for built-in functions imeevma
2020-08-14 15:05 ` [Tarantool-patches] [PATCH v2 06/10] sql: add overloaded versions of the functions imeevma
2020-08-22 14:29   ` Vladislav Shpilevoy
2020-08-14 15:05 ` [Tarantool-patches] [PATCH v2 07/10] sql: move built-in function definitions in _func imeevma
2020-08-22 14:30   ` Vladislav Shpilevoy
2020-08-14 15:05 ` [Tarantool-patches] [PATCH v2 08/10] box: add param_list to 'struct func' imeevma
2020-08-22 14:30   ` Vladislav Shpilevoy
2020-08-14 15:05 ` [Tarantool-patches] [PATCH v2 09/10] sql: check built-in functions argument types imeevma
2020-08-14 15:05 ` [Tarantool-patches] [PATCH v2 10/10] sql: refactor sql/func.c imeevma
2020-08-22 14:31   ` Vladislav Shpilevoy
2020-08-22 14:25 ` [Tarantool-patches] [PATCH v2 00/10] sql: properly check arguments types of built-in functions Vladislav Shpilevoy

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=b0ede159-64da-a6a8-572d-ea1eb219462f@tarantool.org \
    --to=v.shpilevoy@tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tsafin@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 04/10] box: add new options for functions' \
    /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