Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: korablev@tarantool.org, Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: [tarantool-patches] Re: [PATCH v2 5/8] sql: introduce a signature_mask for functions
Date: Tue, 13 Aug 2019 01:04:27 +0300	[thread overview]
Message-ID: <20190812220427.GS32337@atlas> (raw)
In-Reply-To: <6f6689986b1dd79adc478c5da9f1d458da42d483.1565275469.git.kshcherbatov@tarantool.org>

* Kirill Shcherbatov <kshcherbatov@tarantool.org> [19/08/08 17:53]:
> This patch replaces nArgs field with signature_mask bitmask that
> allows to use an only hash table entry for all builtin functions
> overloads.
> 
> The code refactoring is not a goal of this patch: the most of
> affected code would be removed in following patches. The role of
> this patch itself is to introduce such mechanism (signature_mask)
> in Tarantool's SQL.
> 
> Needed for #2200, #4113, #2233
> ---
>  src/box/sql/sqlInt.h   | 70 ++++++++++++++++++++------------
>  src/box/sql/callback.c | 22 +++-------
>  src/box/sql/func.c     | 91 ++++++++++++++++++------------------------
>  src/box/sql/main.c     |  4 +-
>  src/box/sql/vdbeaux.c  |  6 ++-
>  5 files changed, 94 insertions(+), 99 deletions(-)
> 
> diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h
> index 941c87420..114ac0e4b 100644
> --- a/src/box/sql/sqlInt.h
> +++ b/src/box/sql/sqlInt.h
> @@ -1254,7 +1254,20 @@ struct type_def {
>   * field is used by per-connection app-def functions.
>   */
>  struct FuncDef {
> -	i8 nArg;		/* Number of arguments.  -1 means unlimited */
> +	/**
> +	 * A bitmask representing all supported function
> +	 * overloads. The function supports argc == n iff this
> +	 * bitmask has bit n set 1. In particular case, a bitmask
> +	 * (~0) means this function works with any possible
> +	 * argument.
> +	 *
> +	 * The count of arguments for function is limited with
> +	 * (CHAR_BITS*sizeof(uint64_t) - 1). When the highest bit
> +	 * of the mask is set, this means that greater values
> +	 * are supported. E.g. greatest function works correctly
> +	 * with any number of input arguments.
> +	 */
> +	uint64_t signature_mask;

Good idea, but why make the mask sooo big?-)))
I don't think we have more than 3 arguments in any overloaded
function?

> +	if (!column_mask_fieldno_is_set(p->signature_mask, (uint32_t)nArg))
>  		return 0;

Are you sure you want to use column mask api just to test a bit?


-- 
Konstantin Osipov, Moscow, Russia

  reply	other threads:[~2019-08-12 22:04 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-08-08 14:50 [tarantool-patches] [PATCH v2 0/8] sql: uniform SQL and Lua functions subsystem Kirill Shcherbatov
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 1/8] sql: remove SQL_PreferBuiltin flag Kirill Shcherbatov
2019-08-09 16:07   ` [tarantool-patches] " n.pettik
2019-08-12 21:58   ` Konstantin Osipov
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 2/8] sql: GREATEST, LEAST instead of MIN/MAX overload Kirill Shcherbatov
2019-08-09 17:37   ` [tarantool-patches] " n.pettik
2019-08-13  8:26     ` Kirill Shcherbatov
2019-08-12 21:59   ` Konstantin Osipov
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 3/8] sql: wrap all trim functions in dispatcher Kirill Shcherbatov
2019-08-09 18:05   ` [tarantool-patches] " n.pettik
2019-08-13  8:28     ` Kirill Shcherbatov
2019-08-13 22:19       ` n.pettik
2019-08-12 22:00   ` Konstantin Osipov
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 4/8] sql: get rid of SQL_FUNC_COUNT flag Kirill Shcherbatov
2019-08-12 22:01   ` [tarantool-patches] " Konstantin Osipov
2019-08-13 20:35   ` n.pettik
2019-08-14  7:25     ` Kirill Shcherbatov
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 5/8] sql: introduce a signature_mask for functions Kirill Shcherbatov
2019-08-12 22:04   ` Konstantin Osipov [this message]
2019-08-13  8:32     ` [tarantool-patches] " Kirill Shcherbatov
2019-08-13  8:44       ` Konstantin Osipov
2019-08-13 20:38   ` n.pettik
2019-08-14  7:21     ` Kirill Shcherbatov
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 6/8] sql: rename OP_Function to OP_BuiltinFunction Kirill Shcherbatov
2019-08-12 22:04   ` [tarantool-patches] " Konstantin Osipov
2019-08-13 20:36   ` n.pettik
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 7/8] sql: get rid of FuncDef function hash Kirill Shcherbatov
2019-08-12 22:11   ` [tarantool-patches] " Konstantin Osipov
2019-08-13  7:29     ` Kirill Shcherbatov
2019-08-13  8:42       ` Konstantin Osipov
2019-08-13  9:45         ` Kirill Shcherbatov
2019-08-13 20:40   ` n.pettik
2019-08-16 12:57     ` Kirill Shcherbatov
2019-08-20 16:06       ` n.pettik
2019-08-08 14:50 ` [tarantool-patches] [PATCH v2 8/8] box: get rid of box.internal.sql_function_create Kirill Shcherbatov
2019-08-13 20:43   ` [tarantool-patches] " n.pettik
2019-08-16 12:57     ` Kirill Shcherbatov
2019-08-20 19:36       ` n.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=20190812220427.GS32337@atlas \
    --to=kostja@tarantool.org \
    --cc=korablev@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --subject='[tarantool-patches] Re: [PATCH v2 5/8] sql: introduce a signature_mask 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