From: Kirill Shcherbatov <kshcherbatov@tarantool.org> To: tarantool-patches@freelists.org, korablev@tarantool.org Cc: Kirill Shcherbatov <kshcherbatov@tarantool.org> Subject: [tarantool-patches] [PATCH v3 6/9] sql: remove SQL_FUNC_SLOCHNG flag Date: Fri, 16 Aug 2019 16:26:52 +0300 [thread overview] Message-ID: <593a90c31707df8aa3b34292a0d931257a3995e0.1565961887.git.kshcherbatov@tarantool.org> (raw) In-Reply-To: <cover.1565961886.git.kshcherbatov@tarantool.org> The SQL_FUNC_SLOCHNG flag was useful for datetime function that are currently not supported. So it could be removed. Needed for #2200, #4113, #2233 --- src/box/sql/sqlInt.h | 15 +-------------- src/box/sql/resolve.c | 4 +--- src/box/sql/vdbemem.c | 6 ++---- 3 files changed, 4 insertions(+), 21 deletions(-) diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h index bc3c639e6..5a3e8f1c1 100644 --- a/src/box/sql/sqlInt.h +++ b/src/box/sql/sqlInt.h @@ -1318,9 +1318,7 @@ struct FuncDestructor { #define SQL_FUNC_UNLIKELY 0x0400 /* Built-in unlikely() function */ #define SQL_FUNC_CONSTANT 0x0800 /* Constant inputs give a constant output */ #define SQL_FUNC_MINMAX 0x1000 /* True for min() and max() aggregates */ -#define SQL_FUNC_SLOCHNG 0x2000 /* "Slow Change". Value constant during a - * single query - might change over time - */ + /** * If function returns string, it may require collation to be * applied on its result. For instance, result of substr() @@ -1359,11 +1357,6 @@ enum trim_side_mask { * VFUNCTION(zName, nArg, iArg, bNC, xFunc) * Like FUNCTION except it omits the sql_FUNC_CONSTANT flag. * - * DFUNCTION(zName, nArg, iArg, bNC, xFunc) - * Like FUNCTION except it omits the sql_FUNC_CONSTANT flag and - * adds the sql_FUNC_SLOCHNG flag. Used for date & time functions, - * but not during a single query. - * * AGGREGATE(zName, nArg, iArg, bNC, xStep, xFinal) * Used to create an aggregate function definition implemented by * the C functions xStep and xFinal. The first four parameters @@ -1387,15 +1380,9 @@ enum trim_side_mask { #define VFUNCTION(zName, nArg, iArg, bNC, xFunc, type) \ {nArg, (bNC*SQL_FUNC_NEEDCOLL), \ SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type} -#define DFUNCTION(zName, nArg, iArg, bNC, xFunc, type) \ - {nArg, SQL_FUNC_SLOCHNG|(bNC*SQL_FUNC_NEEDCOLL), \ - SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type} #define FUNCTION2(zName, nArg, iArg, bNC, xFunc, extraFlags, type) \ {nArg,SQL_FUNC_CONSTANT|(bNC*SQL_FUNC_NEEDCOLL)|extraFlags,\ SQL_INT_TO_PTR(iArg), 0, xFunc, 0, #zName, {0}, type} -#define STR_FUNCTION(zName, nArg, pArg, bNC, xFunc) \ - {nArg, SQL_FUNC_SLOCHNG|(bNC*SQL_FUNC_NEEDCOLL), \ - pArg, 0, xFunc, 0, #zName, {SQL_AFF_STRING, {0}}} #define LIKEFUNC(zName, nArg, arg, flags, type) \ {nArg, SQL_FUNC_NEEDCOLL|SQL_FUNC_CONSTANT|flags, \ (void *)(SQL_INT_TO_PTR(arg)), 0, likeFunc, 0, #zName, {0}, type} diff --git a/src/box/sql/resolve.c b/src/box/sql/resolve.c index 0b90edd06..207f57ba6 100644 --- a/src/box/sql/resolve.c +++ b/src/box/sql/resolve.c @@ -647,9 +647,7 @@ resolveExprStep(Walker * pWalker, Expr * pExpr) 'u' ? 8388608 : 125829120; } } - if (pDef-> - funcFlags & (SQL_FUNC_CONSTANT | - SQL_FUNC_SLOCHNG)) { + if ((pDef->funcFlags & SQL_FUNC_CONSTANT) != 0) { /* For the purposes of the EP_ConstFunc flag, date and time * functions and other functions that change slowly are considered * constant because they are constant for the duration of one query diff --git a/src/box/sql/vdbemem.c b/src/box/sql/vdbemem.c index b8c31ecec..5516d7fb1 100644 --- a/src/box/sql/vdbemem.c +++ b/src/box/sql/vdbemem.c @@ -1302,11 +1302,9 @@ valueFromFunction(sql * db, /* The database connection */ nVal = pList->nExpr; pFunc = sqlFindFunction(db, p->u.zToken, nVal, 0); assert(pFunc); - if ((pFunc->funcFlags & (SQL_FUNC_CONSTANT | SQL_FUNC_SLOCHNG)) == - 0 || (pFunc->funcFlags & SQL_FUNC_NEEDCOLL) - ) { + if ((pFunc->funcFlags & SQL_FUNC_CONSTANT) == 0 || + (pFunc->funcFlags & SQL_FUNC_NEEDCOLL)) return 0; - } if (pList) { apVal = -- 2.22.1
next prev parent reply other threads:[~2019-08-16 13:27 UTC|newest] Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top 2019-08-16 13:26 [tarantool-patches] [PATCH v3 0/9] sql: uniform SQL and Lua functions subsystem Kirill Shcherbatov 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 1/9] sql: remove SQL_PreferBuiltin flag Kirill Shcherbatov 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 2/9] sql: GREATEST, LEAST instead of MIN/MAX overload Kirill Shcherbatov 2019-08-16 18:57 ` [tarantool-patches] " n.pettik 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 3/9] sql: wrap all trim functions in dispatcher Kirill Shcherbatov 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 4/9] sql: rework SQL_FUNC_COUNT flag semantics Kirill Shcherbatov 2019-08-16 18:55 ` [tarantool-patches] " n.pettik 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 5/9] sql: rename OP_Function to OP_BuiltinFunction Kirill Shcherbatov 2019-08-16 13:26 ` Kirill Shcherbatov [this message] 2019-08-16 18:54 ` [tarantool-patches] Re: [PATCH v3 6/9] sql: remove SQL_FUNC_SLOCHNG flag n.pettik 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 7/9] sql: get rid of FuncDef function hash Kirill Shcherbatov 2019-08-16 14:09 ` [tarantool-patches] " Konstantin Osipov 2019-08-16 18:59 ` n.pettik 2019-08-19 15:51 ` Kirill Shcherbatov 2019-08-20 13:47 ` Konstantin Osipov 2019-08-20 19:04 ` n.pettik 2019-08-20 19:12 ` Konstantin Osipov 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 8/9] sql: get rid of box.internal.sql_function_create Kirill Shcherbatov 2019-08-16 13:26 ` [tarantool-patches] [PATCH v3 9/9] sql: better error messages on invalid arguments Kirill Shcherbatov
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=593a90c31707df8aa3b34292a0d931257a3995e0.1565961887.git.kshcherbatov@tarantool.org \ --to=kshcherbatov@tarantool.org \ --cc=korablev@tarantool.org \ --cc=tarantool-patches@freelists.org \ --subject='Re: [tarantool-patches] [PATCH v3 6/9] sql: remove SQL_FUNC_SLOCHNG flag' \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox