From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtpng2.m.smailru.net (smtpng2.m.smailru.net [94.100.179.3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id DD2BD43040C for ; Wed, 12 Aug 2020 18:15:49 +0300 (MSK) From: imeevma@tarantool.org Date: Wed, 12 Aug 2020 18:15:48 +0300 Message-Id: <202a7e7207c04e0196964afca93427dbf208ceec.1597244875.git.imeevma@gmail.com> In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Subject: [Tarantool-patches] [PATCH v1 3/7] sql: move built-in function definitions in _func List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org This patch moves SQL built-in function definitions to _func. This helps create an unified way to check the types of arguments. It also allows users to see these definitions. Part of #4159 --- src/box/bootstrap.snap | Bin 5976 -> 6291 bytes src/box/lua/upgrade.lua | 143 +++++++++++++++++++++++++++++++++++ src/box/sql/func.c | 7 +- src/box/sql/resolve.c | 2 +- test/box-py/bootstrap.result | 2 +- test/sql/types.result | 4 +- 6 files changed, 148 insertions(+), 10 deletions(-) diff --git a/src/box/bootstrap.snap b/src/box/bootstrap.snap index 8bd4f7ce24216a8bcced6aa97c20c83eb7a02c77..9163165b13b27771414243650051e900b3af8def 100644 GIT binary patch literal 6291 zcmV;E7;NWLPC-x#FfK7O3RY!ub7^mGIv_GGHZCwNGc+w{V`5}vGBPz{W(rAeb97;D zV`VxZWMnmFWnwZnEi*P`Gc7bUF)=MTV`MTdGiG8mH#svmHDoj}3RXjGZ)0mZAbWiZ z3e~y`y3H6G0M66h;g_WV00000D77#B08ov<04mfRFi8+_T4gZIFvAQp%phAsj|nab zs5-VJi8n60MkAamBQlQBNCoHrH^?UiRPEJsf;YUCfCAn|Fad9Q3xNa=L@C+a&NsW8>y)xaO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Rvhx`Y!4_LYYScj?h1)Gq< zN*5>#Dg*n`@kQf6{EjV742uZ90hHD{NZC*sxsT5)a@isKmzaNfJaP9H`JagVN9PyW ziSQ*_X15vnK2fCWT!qpr-Q4x3`9!m)ZGS?-!0$<>DgF~AP&SFrflxizEobZ+c<~@v zG&0kq*m?2L^mwER35-VEI}0Zx<$@IB!glL9x(y-nIO4;|R;IQaHw+ZsR-xm0T#9xw z;-C@3Yb7g@guCzP$I2WH1jq*}2#q5NWEFj4eKh|wl0!OPZUkCYFbqoARpk5qm^Q%3 zUtY9@_@U2)>;{vD;a5zxlJMmep>gtE678o1B^M@V6gjw7NEC*xiE4qlVelnVP9thL zJ6tcK2xQQoFL)t5(6R<Z_EH_iMk+W8`~-UKj{0bSve$kR!lyC$Hm;CNd_+G|)jSs0^6k2CiYy#{K5z zOr!;8#y(CbN<{A1N|9)SgzgV88Be)RxS~=DmdFh1f;NMLhix~=wQM*DEW-|s#mgK& z$Fex+HW5}(j=?pi*}i2FcCXTg7#tl`5m3wT;Q{x{+a(T%X=z0qX^g=jE0!<#0HmKAE3X z?Qdlztz~*kV16F^EuOyXbFv$Ai!@dUeVmS-AE`DA>Q_1aKPrC244$$f4BZ>7gR2c- z9D06I7kqkPC<;+e7>HKYja@d|_qf11VYfb79Mvf$v9bdkc9#O*lvDM zjT`tN2r=(}V)SBiSR!VRSBgr9a3?4`d*wNA@*YW<$t}%sllMrP#BMz)0X*Zmx;QY*H}-|Ua*)SWMg1^N_8RIlVbPImSXCMmzA;fFre G5UuU4uRFp3 diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua index add791cd7..54fc82dc6 100644 --- a/src/box/lua/upgrade.lua +++ b/src/box/lua/upgrade.lua @@ -971,6 +971,148 @@ local function upgrade_to_2_3_1() create_session_settings_space() end +-------------------------------------------------------------------------------- +-- Tarantool 2.5.2 +-------------------------------------------------------------------------------- + +local function update_sql_builtin_functions() + local _func = box.space[box.schema.FUNC_ID] + local updates + + _func:run_triggers(false) + updates = {{'=', 'param_list', {'number'}}, {'=', 'returns', 'number'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('ABS', updates) + + updates = {{'=', 'param_list', {'number'}}, {'=', 'returns', 'number'}, + {'=', 'aggregate', 'group'}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('AVG', updates) + _func.index[2]:update('SUM', updates) + _func.index[2]:update('TOTAL', updates) + + updates = {{'=', 'param_list', {'unsigned'}}, {'=', 'returns', 'string'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}, + {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('CHAR', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'integer'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('CHARACTER_LENGTH', updates) + _func.index[2]:update('CHAR_LENGTH', updates) + _func.index[2]:update('LENGTH', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'scalar'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}, + {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('COALESCE', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'integer'}, + {'=', 'aggregate', 'group'}, {'=', 'exports', {'SQL'}}, + {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('COUNT', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'scalar'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}, + {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('GREATEST', updates) + _func.index[2]:update('LEAST', updates) + + updates = {{'=', 'param_list', {'scalar', 'scalar'}}, + {'=', 'returns', 'string'}, {'=', 'aggregate', 'group'}, + {'=', 'exports', {'SQL'}}, {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('GROUP_CONCAT', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'string'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('HEX', updates) + + updates = {{'=', 'param_list', {'scalar', 'scalar'}}, + {'=', 'returns', 'scalar'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}} + _func.index[2]:update('IFNULL', updates) + _func.index[2]:update('NULLIF', updates) + + updates = {{'=', 'param_list', {'scalar', 'scalar', 'scalar'}}, + {'=', 'returns', 'boolean'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}, {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('LIKE', updates) + + updates = {{'=', 'param_list', {'scalar', 'double'}}, + {'=', 'returns', 'scalar'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}} + _func.index[2]:update('LIKELIHOOD', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'scalar'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('LIKELY', updates) + _func.index[2]:update('UNLIKELY', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'string'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('LOWER', updates) + _func.index[2]:update('QUOTE', updates) + _func.index[2]:update('SOUNDEX', updates) + _func.index[2]:update('TYPEOF', updates) + _func.index[2]:update('UPPER', updates) + _func.index[2]:update('UNICODE', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'scalar'}, + {'=', 'aggregate', 'group'}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('MAX', updates) + _func.index[2]:update('MIN', updates) + + updates = {{'=', 'param_list', {'scalar', 'scalar'}}, + {'=', 'returns', 'integer'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}} + _func.index[2]:update('POSITION', updates) + + updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'string'}, + {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}, + {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('PRINTF', updates) + _func.index[2]:update('TRIM', updates) + + updates = {{'=', 'returns', 'integer'}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('RANDOM', updates) + + updates = {{'=', 'returns', 'integer'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}} + _func.index[2]:update('ROW_COUNT', updates) + + updates = {{'=', 'param_list', {'unsigned'}}, + {'=', 'returns', 'varbinary'}, {'=', 'exports', {'SQL'}}} + _func.index[2]:update('RANDOMBLOB', updates) + + updates = {{'=', 'param_list', {'unsigned'}}, + {'=', 'returns', 'varbinary'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}} + _func.index[2]:update('ZEROBLOB', updates) + + updates = {{'=', 'param_list', {'scalar', 'scalar', 'scalar'}}, + {'=', 'returns', 'string'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}} + _func.index[2]:update('REPLACE', updates) + + updates = {{'=', 'param_list', {'double', 'unsigned'}}, + {'=', 'returns', 'double'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}, {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('ROUND', updates) + + updates = {{'=', 'param_list', {'scalar', 'integer', 'integer'}}, + {'=', 'returns', 'string'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}, {'=', 'opts', {has_vararg = true}}} + _func.index[2]:update('SUBSTR', updates) + + updates = {{'=', 'returns', 'string'}, {'=', 'is_deterministic', true}, + {'=', 'exports', {'SQL'}}} + _func.index[2]:update('VERSION', updates) + _func:run_triggers(true) +end + +local function upgrade_to_2_5_2() + update_sql_builtin_functions() +end + -------------------------------------------------------------------------------- local function get_version() @@ -1007,6 +1149,7 @@ local function upgrade(options) {version = mkversion(2, 2, 1), func = upgrade_to_2_2_1, auto = true}, {version = mkversion(2, 3, 0), func = upgrade_to_2_3_0, auto = true}, {version = mkversion(2, 3, 1), func = upgrade_to_2_3_1, auto = true}, + {version = mkversion(2, 5, 2), func = upgrade_to_2_5_2, auto = true}, } for _, handler in ipairs(handlers) do diff --git a/src/box/sql/func.c b/src/box/sql/func.c index 487cdafe1..df15d303a 100644 --- a/src/box/sql/func.c +++ b/src/box/sql/func.c @@ -2188,7 +2188,7 @@ sql_func_by_signature(const char *name, int argc) if (base == NULL || !base->def->exports.sql) return NULL; - if (base->def->param_count != -1 && base->def->param_count != argc) + if (!base->def->opts.has_vararg && base->def->param_count != argc) return NULL; return base; } @@ -2929,11 +2929,6 @@ func_sql_builtin_new(struct func_def *def) 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; } diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c index 6f625dc18..5238555c3 100644 --- a/src/box/sql/resolve.c +++ b/src/box/sql/resolve.c @@ -614,7 +614,7 @@ resolveExprStep(Walker * pWalker, Expr * pExpr) pNC->nErr++; return WRC_Abort; } - if (func->def->param_count != -1 && + if (!func->def->opts.has_vararg && func->def->param_count != n) { uint32_t argc = func->def->param_count; const char *err = tt_sprintf("%d", argc); diff --git a/test/box-py/bootstrap.result b/test/box-py/bootstrap.result index 0876e77a6..c56f07cef 100644 --- a/test/box-py/bootstrap.result +++ b/test/box-py/bootstrap.result @@ -4,7 +4,7 @@ box.internal.bootstrap() box.space._schema:select{} --- - - ['max_id', 511] - - ['version', 2, 3, 1] + - ['version', 2, 5, 2] ... box.space._cluster:select{} --- diff --git a/test/sql/types.result b/test/sql/types.result index 95f7713e8..2498f3a48 100644 --- a/test/sql/types.result +++ b/test/sql/types.result @@ -231,7 +231,7 @@ box.execute("SELECT s LIKE NULL FROM t1;") --- - metadata: - name: COLUMN_1 - type: integer + type: boolean rows: - [null] ... @@ -257,7 +257,7 @@ box.execute("SELECT NULL LIKE s FROM t1;") --- - metadata: - name: COLUMN_1 - type: integer + type: boolean rows: - [null] ... -- 2.25.1