[Tarantool-patches] [PATCH v2 07/10] sql: move built-in function definitions in _func

imeevma at tarantool.org imeevma at tarantool.org
Fri Aug 14 18:05:03 MSK 2020


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. Also, this patch enables overloading for
length(), trim(), position() and substr() functions.

Part of #4159
---
 src/box/bootstrap.snap         | Bin 5976 -> 6446 bytes
 src/box/lua/upgrade.lua        | 192 +++++++++++++++++++++++++++++++++
 src/box/sql/func.c             |   6 --
 test/box-py/bootstrap.result   |   6 +-
 test/box/access.result         |   2 +-
 test/box/access.test.lua       |   2 +-
 test/box/access_bin.result     |   2 +-
 test/box/access_bin.test.lua   |   2 +-
 test/box/access_sysview.result |   8 +-
 test/box/function1.result      |   6 +-
 test/wal_off/func_max.result   |   8 +-
 11 files changed, 212 insertions(+), 22 deletions(-)

diff --git a/src/box/bootstrap.snap b/src/box/bootstrap.snap
index 8bd4f7ce24216a8bcced6aa97c20c83eb7a02c77..17e5e2c65ea977620fae969da73b5449c9227078 100644
GIT binary patch
literal 6446
zcmV+}8PVobPC-x#FfK7O3RY!ub7^mGIv_GGHZCwNG&3z{VK`$kV=*x at VG2oZb97;D
zV`VxZI5{{mH#s$AEnzWaFfBARFg7h>IWRXZIb~sDV>vZ4Wn(xq3RXjGZ)0mZAbWiZ
z3e~y`y3H810M4`=qUWUm00000D77#B08nMc0NU5=Fi8-2Xl2a6Gw=*N1Dp2d#+F*A
z60ngZM6#TmglvJq_#EX=$!Jge7J1w0|Kzo1%_UPNi at +(ZlQ~>}FT|LOA)HF=P_aH#
zqoo}H1NZ{X0v~|TwrSK1iB%s^r5O^3L=UQr#wjWz(gUMWYU+P9$Y%#qt<{qQG`!uQ
z1Kw)D0dIMm!3G#;FoRx@!Pl@&4qK=N7|<%X;A{A#z=E&gbAk$J5`0lGJ2SzTJ4`~&
zNbp6AI`cIw^JV617(vw6aQK9v%oiU%5CI?Zp#u=K!v-E`hfof*!*+OVU^sk&8V;XM
z$D!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vDM
zjT`tN2r=(}V)SBiSR!VRSBgr9a3?4`d*wNA@*YW<$t}%sllMr<Om1n8o4iL-W^zkC
zlcqB+zvOId2>P#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..290741940 100644
--- a/src/box/lua/upgrade.lua
+++ b/src/box/lua/upgrade.lua
@@ -971,6 +971,197 @@ 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 _priv = box.space[box.schema.PRIV_ID]
+    local updates
+    local datetime = os.date("%Y-%m-%d %H:%M:%S")
+    local overloaded_function_list = {
+        "LENGTH_VARBINARY", "POSITION_VARBINARY", "TRIM_VARBINARY",
+        "SUBSTR_VARBINARY",
+    }
+
+    for _, v in pairs(overloaded_function_list) do
+        local t = _func:auto_increment({ADMIN, v, 1, 'SQL_BUILTIN', '',
+                                       'function', {}, 'any', 'none', 'none',
+                                        false, false, true, {}, setmap({}), '',
+                                        datetime, datetime})
+        _priv:replace{ADMIN, PUBLIC, 'function', t.id, box.priv.X}
+    end
+
+    _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', {'string'}}, {'=', 'returns', 'integer'},
+               {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}}
+    _func.index[2]:update('CHARACTER_LENGTH', updates)
+    _func.index[2]:update('CHAR_LENGTH', updates)
+
+    updates = {{'=', 'param_list', {'string'}}, {'=', 'returns', 'integer'},
+               {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}},
+               {'=', 'opts', {has_overload = true}}}
+    _func.index[2]:update('LENGTH', updates)
+
+    updates = {{'=', 'param_list', {'varbinary'}}, {'=', 'returns', 'integer'},
+               {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}},
+               {'=', 'opts', {is_overloaded = true}}}
+    _func.index[2]:update('LENGTH_VARBINARY', 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', {'string', 'string', 'string'}},
+               {'=', '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', {'string'}}, {'=', 'returns', 'string'},
+               {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}}
+    _func.index[2]:update('LOWER', updates)
+    _func.index[2]:update('SOUNDEX', updates)
+    _func.index[2]:update('UNICODE', updates)
+    _func.index[2]:update('UPPER', updates)
+
+    updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'string'},
+               {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}}}
+    _func.index[2]:update('QUOTE', updates)
+    _func.index[2]:update('TYPEOF', 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', {'string', 'string'}},
+               {'=', 'returns', 'integer'}, {'=', 'is_deterministic', true},
+               {'=', 'exports', {'SQL'}}, {'=', 'opts', {has_overload = true}}}
+    _func.index[2]:update('POSITION', updates)
+
+    updates = {{'=', 'param_list', {'varbinary', 'varbinary'}},
+               {'=', 'returns', 'integer'}, {'=', 'is_deterministic', true},
+               {'=', 'exports', {'SQL'}}, {'=', 'opts', {is_overloaded = true}}}
+    _func.index[2]:update('POSITION_VARBINARY', updates)
+
+    updates = {{'=', 'param_list', {'scalar'}}, {'=', 'returns', 'string'},
+               {'=', 'is_deterministic', true}, {'=', 'exports', {'SQL'}},
+               {'=', 'opts', {has_vararg = true}}}
+    _func.index[2]:update('PRINTF', updates)
+
+    updates = {{'=', 'param_list', {'string', 'unsigned', 'string'}},
+               {'=', 'returns', 'string'}, {'=', 'is_deterministic', true},
+               {'=', 'exports', {'SQL'}},
+               {'=', 'opts', {has_vararg = true, has_overload = true}}}
+    _func.index[2]:update('TRIM', updates)
+
+    updates = {{'=', 'param_list', {'varbinary', 'unsigned', 'varbinary'}},
+               {'=', 'returns', 'string'}, {'=', 'is_deterministic', true},
+               {'=', 'exports', {'SQL'}},
+               {'=', 'opts', {has_vararg = true, is_overloaded = true}}}
+    _func.index[2]:update('TRIM_VARBINARY', 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', {'string', 'string', 'string'}},
+               {'=', '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', {'string', 'integer', 'integer'}},
+               {'=', 'returns', 'string'}, {'=', 'is_deterministic', true},
+               {'=', 'exports', {'SQL'}},
+               {'=', 'opts', {has_vararg = true, has_overload = true}}}
+    _func.index[2]:update('SUBSTR', updates)
+
+    updates = {{'=', 'param_list', {'varbinary', 'integer', 'integer'}},
+               {'=', 'returns', 'string'}, {'=', 'is_deterministic', true},
+               {'=', 'exports', {'SQL'}},
+               {'=', 'opts', {has_vararg = true, is_overloaded = true}}}
+    _func.index[2]:update('SUBSTR_VARBINARY', 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 +1198,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 ae1842824..1fbffa535 100644
--- a/src/box/sql/func.c
+++ b/src/box/sql/func.c
@@ -2971,12 +2971,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;
-	def->opts.has_vararg = sql_builtins[idx].param_count == -1;
 	return &func->base;
 }
 
diff --git a/test/box-py/bootstrap.result b/test/box-py/bootstrap.result
index 0876e77a6..289289443 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{}
 ---
@@ -242,6 +242,10 @@ box.space._priv:select{}
   - [1, 2, 'function', 65, 4]
   - [1, 2, 'function', 66, 4]
   - [1, 2, 'function', 67, 4]
+  - [1, 2, 'function', 68, 4]
+  - [1, 2, 'function', 69, 4]
+  - [1, 2, 'function', 70, 4]
+  - [1, 2, 'function', 71, 4]
   - [1, 2, 'space', 276, 2]
   - [1, 2, 'space', 277, 1]
   - [1, 2, 'space', 281, 1]
diff --git a/test/box/access.result b/test/box/access.result
index 20b1b8b35..b72fa8b02 100644
--- a/test/box/access.result
+++ b/test/box/access.result
@@ -703,7 +703,7 @@ box.schema.func.exists(1)
 ---
 - true
 ...
-box.schema.func.exists(68)
+box.schema.func.exists(72)
 ---
 - false
 ...
diff --git a/test/box/access.test.lua b/test/box/access.test.lua
index 3e083a383..759d0a94f 100644
--- a/test/box/access.test.lua
+++ b/test/box/access.test.lua
@@ -282,7 +282,7 @@ box.schema.user.exists{}
 box.schema.func.exists('nosuchfunc')
 box.schema.func.exists('guest')
 box.schema.func.exists(1)
-box.schema.func.exists(68)
+box.schema.func.exists(72)
 box.schema.func.exists('box.schema.user.info')
 box.schema.func.exists()
 box.schema.func.exists(nil)
diff --git a/test/box/access_bin.result b/test/box/access_bin.result
index c58f331d3..d345e5996 100644
--- a/test/box/access_bin.result
+++ b/test/box/access_bin.result
@@ -298,7 +298,7 @@ box.schema.user.grant('guest', 'execute', 'universe')
 function f1() return box.space._func:get(1)[4] end
 ---
 ...
-function f2() return box.space._func:get(68)[4] end
+function f2() return box.space._func:get(72)[4] end
 ---
 ...
 box.schema.func.create('f1')
diff --git a/test/box/access_bin.test.lua b/test/box/access_bin.test.lua
index 41d5f4245..13d8041a9 100644
--- a/test/box/access_bin.test.lua
+++ b/test/box/access_bin.test.lua
@@ -112,7 +112,7 @@ test:drop()
 -- notice that guest can execute stuff, but can't read space _func
 box.schema.user.grant('guest', 'execute', 'universe')
 function f1() return box.space._func:get(1)[4] end
-function f2() return box.space._func:get(68)[4] end
+function f2() return box.space._func:get(72)[4] end
 box.schema.func.create('f1')
 box.schema.func.create('f2',{setuid=true})
 c = net.connect(box.cfg.listen)
diff --git a/test/box/access_sysview.result b/test/box/access_sysview.result
index 799d19f03..f9ffae127 100644
--- a/test/box/access_sysview.result
+++ b/test/box/access_sysview.result
@@ -258,11 +258,11 @@ box.session.su('guest')
 ...
 #box.space._vpriv:select{}
 ---
-- 82
+- 86
 ...
 #box.space._vfunc:select{}
 ---
-- 67
+- 71
 ...
 #box.space._vcollation:select{}
 ---
@@ -290,11 +290,11 @@ box.session.su('guest')
 ...
 #box.space._vpriv:select{}
 ---
-- 82
+- 86
 ...
 #box.space._vfunc:select{}
 ---
-- 67
+- 71
 ...
 #box.space._vsequence:select{}
 ---
diff --git a/test/box/function1.result b/test/box/function1.result
index 928cd5758..3cce0f4e2 100644
--- a/test/box/function1.result
+++ b/test/box/function1.result
@@ -97,7 +97,7 @@ box.func["function1.args"]
   exports:
     lua: true
     sql: false
-  id: 68
+  id: 72
   setuid: false
   is_multikey: false
   is_deterministic: false
@@ -593,7 +593,7 @@ func
   exports:
     lua: true
     sql: false
-  id: 68
+  id: 72
   setuid: false
   is_multikey: false
   is_deterministic: false
@@ -665,7 +665,7 @@ func
   exports:
     lua: true
     sql: false
-  id: 68
+  id: 72
   setuid: false
   is_multikey: false
   is_deterministic: false
diff --git a/test/wal_off/func_max.result b/test/wal_off/func_max.result
index 78db38d6b..1aef99c66 100644
--- a/test/wal_off/func_max.result
+++ b/test/wal_off/func_max.result
@@ -42,11 +42,11 @@ test_run:cmd("setopt delimiter ''");
 ...
 func_limit()
 ---
-- error: 'Failed to create function ''func31934'': function id is too big'
+- error: 'Failed to create function ''func31930'': function id is too big'
 ...
 drop_limit_func()
 ---
-- error: Function 'func31934' does not exist
+- error: Function 'func31930' does not exist
 ...
 box.schema.user.create('testuser')
 ---
@@ -62,11 +62,11 @@ session.su('testuser')
 ...
 func_limit()
 ---
-- error: 'Failed to create function ''func31934'': function id is too big'
+- error: 'Failed to create function ''func31930'': function id is too big'
 ...
 drop_limit_func()
 ---
-- error: Function 'func31934' does not exist
+- error: Function 'func31930' does not exist
 ...
 session.su('admin')
 ---
-- 
2.25.1



More information about the Tarantool-patches mailing list