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 v3 7/9] sql: get rid of FuncDef function hash
Date: Fri, 16 Aug 2019 17:09:02 +0300 [thread overview]
Message-ID: <20190816140902.GC18643@atlas> (raw)
In-Reply-To: <f2c5281d2cdf2d5d7644521684f744313b99c6e2.1565961887.git.kshcherbatov@tarantool.org>
* Kirill Shcherbatov <kshcherbatov@tarantool.org> [19/08/16 16:29]:
> --- a/src/box/func.c
> +++ b/src/box/func.c
> @@ -39,6 +39,7 @@
> #include "port.h"
> #include "schema.h"
> #include "session.h"
> +#include "sql.h"
> #include <dlfcn.h>
Why?
> +struct func *
> +sql_func_by_signature(const char *name, int argc)
> +{
> + struct func *func = func_by_name(name, strlen(name));
> + if (func == NULL || !func->def->exports.sql)
> + return NULL;
> + if (func->def->language == FUNC_LANGUAGE_SQL_BUILTIN) {
> + if (strcmp(func->def->name, "COALESCE") == 0) {
> + if (argc == 0 || argc == 1)
> + return NULL;
> + argc = func->def->param_count;
> + } else if (strcmp(func->def->name, "COUNT") == 0) {
> + if (argc != 0 && argc != 1)
> + return NULL;
> + argc = func->def->param_count;
> + } else if (strcmp(func->def->name, "GROUP_CONCAT") == 0) {
> + if (argc != 1 && argc != 2)
> + return NULL;
> + argc = func->def->param_count;
> + } else if (strcmp(func->def->name, "LIKE") == 0) {
> + if (argc != 2 && argc != 3)
> + return NULL;
> + argc = func->def->param_count;
> + } else if (strcmp(func->def->name, "ROUND") == 0) {
> + if (argc != 1 && argc != 2)
> + return NULL;
> + argc = func->def->param_count;
> + } else if (strcmp(func->def->name, "SUBSTR") == 0) {
> + if (argc != 2 && argc != 3)
> + return NULL;
> + argc = func->def->param_count;
> + } else if (strcmp(func->def->name, "TRIM") == 0) {
> + if (argc != 1 && argc != 2 && argc != 3)
> + return NULL;
> + argc = func->def->param_count;
> + }
> + }
> + if (func->def->param_count != -1 && argc != func->def->param_count)
> + return NULL;
> + return func;
> +}
Why can't you have this as a check() method of sql_builtin_func, set for the specific functions which nee
this check, why do you have to have a switch + strcmp during runtime?
overall, this patch is huge. It is frustrating that the previous
patches on the stack are tacking so long to push. They should have
been finished & pushed so that this patch could be split into
pieces and worked on faster.
Nikita, could you please finish your review of all the patches up
to this one?
--
Konstantin Osipov, Moscow, Russia
next prev parent reply other threads:[~2019-08-16 14:09 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-08-16 13:26 [tarantool-patches] [PATCH v3 0/9] sql: uniform SQL and Lua functions subsystem Kirill Shcherbatov
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 1/9] sql: remove SQL_PreferBuiltin flag Kirill Shcherbatov
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 2/9] sql: GREATEST, LEAST instead of MIN/MAX overload Kirill Shcherbatov
2019-08-16 18:57 ` [tarantool-patches] " n.pettik
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 3/9] sql: wrap all trim functions in dispatcher Kirill Shcherbatov
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 4/9] sql: rework SQL_FUNC_COUNT flag semantics Kirill Shcherbatov
2019-08-16 18:55 ` [tarantool-patches] " n.pettik
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 5/9] sql: rename OP_Function to OP_BuiltinFunction Kirill Shcherbatov
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 6/9] sql: remove SQL_FUNC_SLOCHNG flag Kirill Shcherbatov
2019-08-16 18:54 ` [tarantool-patches] " n.pettik
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 7/9] sql: get rid of FuncDef function hash Kirill Shcherbatov
2019-08-16 14:09 ` Konstantin Osipov [this message]
2019-08-16 18:59 ` [tarantool-patches] " n.pettik
2019-08-19 15:51 ` Kirill Shcherbatov
2019-08-20 13:47 ` Konstantin Osipov
2019-08-20 19:04 ` n.pettik
2019-08-20 19:12 ` Konstantin Osipov
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 8/9] sql: get rid of box.internal.sql_function_create Kirill Shcherbatov
2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 9/9] sql: better error messages on invalid arguments Kirill Shcherbatov
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=20190816140902.GC18643@atlas \
--to=kostja@tarantool.org \
--cc=korablev@tarantool.org \
--cc=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='[tarantool-patches] Re: [PATCH v3 7/9] sql: get rid of FuncDef function hash' \
/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