From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 28AA726A6F for ; Thu, 8 Aug 2019 10:50:59 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id yw756ha22oH0 for ; Thu, 8 Aug 2019 10:50:59 -0400 (EDT) Received: from smtp5.mail.ru (smtp5.mail.ru [94.100.179.24]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 74C7925EB0 for ; Thu, 8 Aug 2019 10:50:58 -0400 (EDT) From: Kirill Shcherbatov Subject: [tarantool-patches] [PATCH v2 0/8] sql: uniform SQL and Lua functions subsystem Date: Thu, 8 Aug 2019 17:50:44 +0300 Message-Id: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org, korablev@tarantool.org Cc: Kirill Shcherbatov 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. Changes in version 2: - introduced GREATER, LESSER entries - reworked multiple signatures for functions: only SQL builtins support name overload and it is trivial and processed by single function implementation - introduced OP_BuiltinFunction to use func_sql_builtin's function implementation directly without port proxy object Branch: http://github.com/tarantool/tarantool/tree/kshch/gh-4182-persistent-functions Issue: https://github.com/tarantool/tarantool/issues/2233 Kirill Shcherbatov (8): sql: remove SQL_PreferBuiltin flag sql: GREATEST, LEAST instead of MIN/MAX overload sql: wrap all trim functions in dispatcher sql: get rid of SQL_FUNC_COUNT flag sql: introduce a signature_mask for functions sql: rename OP_Function to OP_BuiltinFunction sql: get rid of FuncDef function hash box: get rid of box.internal.sql_function_create src/box/func_def.h | 2 +- src/box/lua/lua_sql.h | 39 -- src/box/port.h | 17 + src/box/sql.h | 5 + src/box/sql/sqlInt.h | 240 ++++-------- src/box/sql/vdbe.h | 9 +- src/box/sql/vdbeInt.h | 26 +- src/lib/core/port.h | 19 + src/box/call.c | 1 + src/box/execute.c | 1 + src/box/func.c | 34 +- src/box/lua/call.c | 6 +- src/box/lua/lua_sql.c | 205 ----------- src/box/port.c | 4 + src/box/sql.c | 24 ++ src/box/sql/analyze.c | 41 +-- src/box/sql/callback.c | 212 +---------- src/box/sql/date.c | 28 -- src/box/sql/expr.c | 64 ++-- src/box/sql/func.c | 627 ++++++++++++++++++++++++++------ src/box/sql/global.c | 7 - src/box/sql/main.c | 137 ------- src/box/sql/resolve.c | 50 +-- src/box/sql/select.c | 9 +- src/box/sql/vdbe.c | 94 +++-- src/box/sql/vdbeapi.c | 11 +- src/box/sql/vdbeaux.c | 31 +- src/box/sql/vdbemem.c | 50 ++- src/box/sql/whereexpr.c | 2 +- src/box/CMakeLists.txt | 1 - src/box/bootstrap.snap | Bin 5907 -> 5944 bytes src/box/lua/schema.lua | 3 +- src/box/lua/upgrade.lua | 20 + test-run | 2 +- test/box-py/bootstrap.result | 4 +- 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 | 134 +++---- test/box/access_sysview.result | 8 +- test/box/function1.result | 179 ++++++++- test/box/function1.test.lua | 62 +++- test/sql-tap/alias.test.lua | 11 +- test/sql-tap/check.test.lua | 11 +- test/sql-tap/coalesce.test.lua | 2 +- test/sql-tap/func3.test.lua | 12 +- test/sql-tap/func5.test.lua | 61 ++-- test/sql-tap/in1.test.lua | 6 +- test/sql-tap/insert1.test.lua | 2 +- test/sql-tap/lua_sql.test.lua | 121 +++--- test/sql-tap/misc1.test.lua | 2 +- test/sql-tap/select1.test.lua | 22 +- test/sql-tap/select2.test.lua | 6 +- test/sql-tap/select3.test.lua | 2 +- test/sql-tap/subquery.test.lua | 21 +- test/sql-tap/trigger9.test.lua | 8 +- test/sql-tap/where2.test.lua | 4 +- test/sql-tap/with1.test.lua | 2 +- test/sql/errinj.result | 26 -- test/sql/errinj.test.lua | 10 - test/sql/func-recreate.result | 41 ++- test/sql/func-recreate.test.lua | 26 +- test/sql/iproto.result | 8 +- test/sql/iproto.test.lua | 4 +- test/sql/types.result | 12 +- test/sql/types.test.lua | 6 +- test/wal_off/func_max.result | 8 +- 68 files changed, 1458 insertions(+), 1392 deletions(-) delete mode 100644 src/box/lua/lua_sql.h delete mode 100644 src/box/lua/lua_sql.c -- 2.22.0