From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: From: Kirill Shcherbatov Subject: [PATCH v1 00/12] sql: uniform SQL and Lua functions subsystem Date: Mon, 8 Jul 2019 14:26:14 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit To: tarantool-patches@freelists.org, korablev@tarantool.org Cc: kostja@tarantool.org, vdavydov.dev@gmail.com, Kirill Shcherbatov List-ID: This patchset reworks SQL functions subsystem. Previously Tarantool's SQL used an own FuncDef function representation and corresponding FuncDef cache. Replacing it with Tarantool's uniform function representation makes possible to call any function on any supported language in SQL. The commit 'introduce Lua persistent functions' has been reviewed by Vova in past, but reverted by Kostya, becuase it introduces schema changes making sense in scope of this new patchset. Mostly it should be good enough. Please pay attention, that it updates test-run module and an pretest_cleanup updates must be merged before it. Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-4182-persistent-functions Issue: https://github.com/tarantool/tarantool/issues/4182 Kirill Shcherbatov (12): sql: rfc for SQL and Lua functions sql: get rid of SOUNDEX, MATCH sql: get rid of LIKELY, UNLIKELY and LIKEHOOD box: introduce Lua persistent functions sql: put analyze helpers to FuncDef cache sql: rework LIKE case-insensitive mode sql: replace bool is_derived_coll marker with flag sql: refactor builtins signatures with port box: use own vtab per each function object sql: remove SQL_PreferBuiltin flag sql: move LIKE UConverter object to collation library sql: use schema's func hash instead of FuncDef hash doc/rfc/4182-persistent-lua-functions.md | 214 +++ src/box/CMakeLists.txt | 1 - src/box/alter.cc | 155 +- src/box/bootstrap. | Bin 0 -> 5528 bytes src/box/bootstrap.snap | Bin 4475 -> 5541 bytes src/box/call.c | 1 + src/box/execute.c | 2 + src/box/func.c | 31 +- src/box/func.h | 7 +- src/box/func_def.c | 43 +- src/box/func_def.h | 61 +- src/box/lua/call.c | 249 ++- src/box/lua/lua_sql.c | 204 --- src/box/lua/lua_sql.h | 39 - src/box/lua/schema.lua | 21 +- src/box/lua/upgrade.lua | 63 +- src/box/port.c | 5 + src/box/port.h | 19 + src/box/schema_def.h | 14 + src/box/sql.h | 18 + src/box/sql/analyze.c | 222 ++- src/box/sql/callback.c | 211 --- src/box/sql/date.c | 28 - src/box/sql/expr.c | 77 +- src/box/sql/func.c | 2115 ++++++++++++++-------- src/box/sql/global.c | 7 - src/box/sql/main.c | 160 +- src/box/sql/pragma.c | 8 - src/box/sql/printf.c | 7 +- src/box/sql/resolve.c | 107 +- src/box/sql/select.c | 10 +- src/box/sql/sqlInt.h | 262 +-- src/box/sql/vdbe.c | 97 +- src/box/sql/vdbe.h | 6 +- src/box/sql/vdbeInt.h | 38 +- src/box/sql/vdbeapi.c | 194 +- src/box/sql/vdbeaux.c | 31 +- src/box/sql/vdbemem.c | 144 +- src/box/sql/where.c | 166 +- src/box/sql/whereInt.h | 1 - src/box/sql/whereexpr.c | 10 +- src/lib/coll/coll.c | 8 +- src/lib/coll/coll.h | 2 + src/lib/core/port.h | 31 + test-run | 2 +- test/box-py/bootstrap.result | 12 +- test/box-py/bootstrap.test.py | 2 +- test/box/access_misc.result | 10 +- test/box/function1.result | 392 +++- test/box/function1.test.lua | 133 +- test/sql-tap/alias.test.lua | 11 +- test/sql-tap/check.test.lua | 13 +- test/sql-tap/collation.test.lua | 2 +- test/sql-tap/e_expr.test.lua | 26 +- test/sql-tap/func.test.lua | 75 +- test/sql-tap/func3.test.lua | 289 --- test/sql-tap/func5.test.lua | 29 +- test/sql-tap/lua_sql.test.lua | 120 +- test/sql-tap/orderby5.test.lua | 2 +- test/sql-tap/select4.test.lua | 12 +- test/sql-tap/sql-errors.test.lua | 12 +- test/sql-tap/subquery.test.lua | 21 +- test/sql-tap/trigger9.test.lua | 6 +- test/sql-tap/where2.test.lua | 4 +- test/sql-tap/whereG.test.lua | 87 +- test/sql/errinj.result | 25 - test/sql/errinj.test.lua | 10 - test/sql/func-recreate.result | 41 +- test/sql/func-recreate.test.lua | 28 +- test/wal_off/func_max.result | 8 +- 70 files changed, 3498 insertions(+), 2963 deletions(-) create mode 100644 doc/rfc/4182-persistent-lua-functions.md create mode 100644 src/box/bootstrap. delete mode 100644 src/box/lua/lua_sql.c delete mode 100644 src/box/lua/lua_sql.h delete mode 100755 test/sql-tap/func3.test.lua -- 2.21.0