From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: [Tarantool-patches] [PATCH v2 6/6] sql: remove unnecessary function initialization Date: Wed, 4 Aug 2021 15:58:47 +0300 [thread overview] Message-ID: <20a13f2ae829a4fffcd95e120f31293efdfad506.1628081224.git.imeevma@gmail.com> (raw) In-Reply-To: <cover.1628081224.git.imeevma@gmail.com> After removing the SQL built-in functions from _func, the code used to initialize these SQL built-in functions is no longer used and should be removed. Follow-up #6106 --- src/box/func.c | 7 ------- src/box/sql/func.c | 49 ---------------------------------------------- 2 files changed, 56 deletions(-) diff --git a/src/box/func.c b/src/box/func.c index 731f18a3b..04ae1b958 100644 --- a/src/box/func.c +++ b/src/box/func.c @@ -394,10 +394,6 @@ restore_fail: static struct func * func_c_new(struct func_def *def); -/** Construct a SQL builtin function object. */ -extern struct func * -func_sql_builtin_new(struct func_def *def); - struct func * func_new(struct func_def *def) { @@ -409,9 +405,6 @@ func_new(struct func_def *def) case FUNC_LANGUAGE_LUA: func = func_lua_new(def); break; - case FUNC_LANGUAGE_SQL_BUILTIN: - func = func_sql_builtin_new(def); - break; default: unreachable(); } diff --git a/src/box/sql/func.c b/src/box/sql/func.c index 2a3a5d457..50014b756 100644 --- a/src/box/sql/func.c +++ b/src/box/sql/func.c @@ -2789,55 +2789,6 @@ sql_built_in_functions_cache_free(void) mh_strnptr_delete(built_in_functions); } -struct func * -func_sql_builtin_new(struct func_def *def) -{ - assert(def->language == FUNC_LANGUAGE_SQL_BUILTIN); - /** Binary search for corresponding builtin entry. */ - int idx = -1, left = 0, right = nelem(sql_builtins) - 1; - while (left <= right) { - uint32_t mid = (left + right) / 2; - int rc = strcmp(def->name, sql_builtins[mid].name); - if (rc == 0) { - idx = mid; - break; - } - if (rc < 0) - right = mid - 1; - else - left = mid + 1; - } - /* - * All SQL built-in(s) (stubs) are defined in a snapshot. - * Implementation-specific metadata is defined in - * sql_builtins list. When a definition were not found - * above, the function name is invalid, i.e. it is - * not built-in function. - */ - if (idx == -1) { - diag_set(ClientError, ER_CREATE_FUNCTION, def->name, - "given built-in is not predefined"); - return NULL; - } - struct func_sql_builtin *func = - (struct func_sql_builtin *) calloc(1, sizeof(*func)); - if (func == NULL) { - diag_set(OutOfMemory, sizeof(*func), "malloc", "func"); - return NULL; - } - func->base.def = def; - func->base.vtab = &func_sql_builtin_vtab; - func->flags = sql_builtins[idx].flags; - func->call = sql_builtins[idx].call; - func->finalize = sql_builtins[idx].finalize; - def->param_count = sql_builtins[idx].param_count; - def->is_deterministic = sql_builtins[idx].is_deterministic; - def->returns = sql_builtins[idx].returns; - def->aggregate = sql_builtins[idx].aggregate; - def->exports.sql = sql_builtins[idx].export_to_sql; - return &func->base; -} - static void func_sql_builtin_destroy(struct func *func) { -- 2.25.1
next prev parent reply other threads:[~2021-08-04 13:01 UTC|newest] Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-04 12:58 [Tarantool-patches] [PATCH v2 0/6] Remove SQL built-in functions from _func Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 1/6] sql: introduce sql_func_flags() Mergen Imeev via Tarantool-patches 2021-08-05 22:14 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:41 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 2/6] sql: introduce sql_func_find() Mergen Imeev via Tarantool-patches 2021-08-05 22:15 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:42 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 3/6] sql: remove SQL built-in functions from _func Mergen Imeev via Tarantool-patches 2021-08-05 22:17 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:45 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 4/6] alter: parse data dictionary version Mergen Imeev via Tarantool-patches 2021-08-05 22:17 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:47 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` [Tarantool-patches] [PATCH v2 5/6] alter: disallow creation of SQL built-in function Mergen Imeev via Tarantool-patches 2021-08-05 22:18 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 19:54 ` Mergen Imeev via Tarantool-patches 2021-08-04 12:58 ` Mergen Imeev via Tarantool-patches [this message] 2021-08-06 19:59 ` [Tarantool-patches] [PATCH v2 6/6] sql: remove unnecessary function initialization Mergen Imeev via Tarantool-patches 2021-08-08 12:08 ` [Tarantool-patches] [PATCH v2 0/6] Remove SQL built-in functions from _func Vladislav Shpilevoy via Tarantool-patches 2021-08-09 7:18 Mergen Imeev via Tarantool-patches 2021-08-09 7:19 ` [Tarantool-patches] [PATCH v2 6/6] sql: remove unnecessary function initialization Mergen Imeev via Tarantool-patches
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=20a13f2ae829a4fffcd95e120f31293efdfad506.1628081224.git.imeevma@gmail.com \ --to=tarantool-patches@dev.tarantool.org \ --cc=imeevma@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v2 6/6] sql: remove unnecessary function initialization' \ /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