[tarantool-patches] Re: [PATCH v2 7/8] sql: get rid of FuncDef function hash
Konstantin Osipov
kostja at tarantool.org
Tue Aug 13 01:11:50 MSK 2019
* Kirill Shcherbatov <kshcherbatov at tarantool.org> [19/08/08 17:53]:
I like the patch, there is only one nit here:
> -void
> -sqlRegisterBuiltinFunctions(void)
> +static struct {
> + const char *name;
> + uint64_t signature_mask;
> + enum field_type returns;
> + uint16_t flags;
> + void (*call)(sql_context *ctx, int argc, sql_value **argv);
> + void (*finalize)(sql_context *ctx);
> + void *user_data;
> + enum func_aggregate aggregate;
> + bool is_deterministic;
> +} sql_builtins[] = {
> + REG_FUNC("ABS", ARGC_MASK(1), FIELD_TYPE_NUMBER, 0,
> + absFunc, NULL, true),
This looks like huge overengineering.
A bunch of macros, a binary search, can you just open-code
inserting all of these functions into the hash? It would be
perhaps a bit more copy-paste, but it will be easy to maintain.
Am I missing something?
--
Konstantin Osipov, Moscow, Russia
More information about the Tarantool-patches
mailing list