[tarantool-patches] [PATCH v2 00/12] sql: uniform SQL and Lua functions subsystem

Kirill Shcherbatov kshcherbatov at tarantool.org
Wed Jul 10 14:00:56 MSK 2019


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.

Changes in version 2:
  - patches are reordered in the patchset
  - fixed compilation
  - dropped _sql_record entry, introduced GREATER, LESSER entries
  - few minor fixes

Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-4182-persistent-functions
Issue: https://github.com/tarantool/tarantool/issues/4182

Kirill Shcherbatov (12):
  sql: get rid of SOUNDEX, MATCH
  sql: get rid of LIKELY, UNLIKELY and LIKEHOOD
  sql: put analyze helpers to FuncDef cache
  sql: rework LIKE case-insensitive mode
  sql: replace bool is_derived_coll marker with flag
  sql: remove SQL_PreferBuiltin flag
  sql: move LIKE UConverter object to collation library
  sql: rfc for SQL and Lua functions
  box: introduce Lua persistent functions
  sql: refactor builtins signatures with port
  box: use own vtab per each function object
  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 -> 5794 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                  |   67 +-
 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                    |  174 +-
 src/box/sql/callback.c                   |  211 ---
 src/box/sql/date.c                       |   28 -
 src/box/sql/expr.c                       |   77 +-
 src/box/sql/func.c                       | 2117 ++++++++++++++--------
 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                     |  258 +--
 src/box/sql/vdbe.c                       |  112 +-
 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             |   76 +-
 test/box-py/bootstrap.test.py            |    2 +-
 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_misc.result              |  133 +-
 test/box/access_sysview.result           |    8 +-
 test/box/alter.result                    |    2 +-
 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 +-
 76 files changed, 3653 insertions(+), 2982 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





More information about the Tarantool-patches mailing list