From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 1603070353; Thu, 28 Oct 2021 13:53:31 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 1603070353 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1635418411; bh=uhREQpkogr9Z3VUYLQuSNFkkYVSOo6GG4G6XbrjqTKs=; h=To:Cc:Date:In-Reply-To:References:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=voZyKU7S54TKlr4YEAZKWgOdjzM6XI/mCZ52c10cMdOzIpHZxk5BpqUmtoVAi6ccZ MZFKBFDpbTeUWsqaalQkGMa9IYn+OFCWIw9nywlGbIEahvpQ2EeQOC5vKJLFEOMcNB s46/nV4hW9qGeOe2d1k1ZP67JquuSAdKIHrB8Q3A= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 233F37122A for ; Thu, 28 Oct 2021 13:52:32 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 233F37122A Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mg31L-0004Bm-Hw; Thu, 28 Oct 2021 13:52:31 +0300 To: v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Date: Thu, 28 Oct 2021 13:52:31 +0300 Message-Id: <6da5a36c12d60ccce9eae9ac77989aca5db1cf50.1635418233.git.imeevma@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-4EC0790: 10 X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9E6B4260954843F6F3E786F33575CCF95BE72D31FADAB1DEE00894C459B0CD1B9706FD1B6C19194B6CB6F55BFA5B0FB6E907A1929F371C46D87CACECC26227EC5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7607B8778E2C6A697EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F79006371B0187663A04449C8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8E2F66D7DF620160E9D132BDEF5811692117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC3A703B70628EAD7BA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD182CC0D3CB04F14752D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B62CFFCC7B69C47339089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-C1DE0DAB: C20DE7B7AB408E4181F030C43753B8186998911F362727C414F749A5E30D975CA496FB89EAD9B8BEED36867B51D13DC9B0A93C81F4E7D0BE9C2B6934AE262D3EE7EAB7254005DCED7532B743992DF240BDC6A1CF3F042BAD6DF99611D93F60EF5A3EDA775A1E0ED0699F904B3F4130E343918A1A30D5E7FCCB5012B2E24CD356 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34980A6B448CFD1B8AD471BC523A1AD218413F8E246FD12AD58B9A24114E2C0B978B34866C3739A8BA1D7E09C32AA3244C7D45B7BAE7311B32C94D47ECF4844680E8FBBEFAE1C4874C729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojdMRfVmNkPDg3MUl91heV+A== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D5B0FAC1B1C111F632DDA1D266ECDFD8283D72C36FC87018B9F80AB2734326CD2FB559BB5D741EB96352A0ABBE4FDA4210A04DAD6CC59E33667EA787935ED9F1B X-Mras: Ok Subject: [Tarantool-patches] [PATCH v1 2/3] sql: use field_type_MAX instead of FIELD_TYPE_ANY X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Mergen Imeev via Tarantool-patches Reply-To: imeevma@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" After this patch, the built-in SQL function implementation definitions will use field_type_MAX to indicate that they accept values of any type, instead of FIELD_TYPE_ANY. Part of #3174 --- src/box/sql/func.c | 22 +++++++++++----------- src/box/sql/mem.c | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/box/sql/func.c b/src/box/sql/func.c index 0cf17572b..63d7536d9 100644 --- a/src/box/sql/func.c +++ b/src/box/sql/func.c @@ -1937,10 +1937,10 @@ static struct sql_func_definition definitions[] = { {"CHAR", -1, {FIELD_TYPE_INTEGER}, FIELD_TYPE_STRING, charFunc, NULL}, {"CHAR_LENGTH", 1, {FIELD_TYPE_STRING}, FIELD_TYPE_INTEGER, lengthFunc, NULL}, - {"COALESCE", -1, {FIELD_TYPE_ANY}, FIELD_TYPE_SCALAR, sql_builtin_stub, + {"COALESCE", -1, {field_type_MAX}, FIELD_TYPE_SCALAR, sql_builtin_stub, NULL}, {"COUNT", 0, {}, FIELD_TYPE_INTEGER, step_count, fin_count}, - {"COUNT", 1, {FIELD_TYPE_ANY}, FIELD_TYPE_INTEGER, step_count, + {"COUNT", 1, {field_type_MAX}, FIELD_TYPE_INTEGER, step_count, fin_count}, {"GREATEST", -1, {FIELD_TYPE_INTEGER}, FIELD_TYPE_INTEGER, minmaxFunc, @@ -1967,7 +1967,7 @@ static struct sql_func_definition definitions[] = { FIELD_TYPE_VARBINARY, step_group_concat, NULL}, {"HEX", 1, {FIELD_TYPE_VARBINARY}, FIELD_TYPE_STRING, hexFunc, NULL}, - {"IFNULL", 2, {FIELD_TYPE_ANY, FIELD_TYPE_ANY}, FIELD_TYPE_SCALAR, + {"IFNULL", 2, {field_type_MAX, field_type_MAX}, FIELD_TYPE_SCALAR, sql_builtin_stub, NULL}, {"LEAST", -1, {FIELD_TYPE_INTEGER}, FIELD_TYPE_INTEGER, minmaxFunc, @@ -1988,9 +1988,9 @@ static struct sql_func_definition definitions[] = { FIELD_TYPE_BOOLEAN, likeFunc, NULL}, {"LIKE", 3, {FIELD_TYPE_STRING, FIELD_TYPE_STRING, FIELD_TYPE_STRING}, FIELD_TYPE_BOOLEAN, likeFunc, NULL}, - {"LIKELIHOOD", 2, {FIELD_TYPE_ANY, FIELD_TYPE_DOUBLE}, + {"LIKELIHOOD", 2, {field_type_MAX, FIELD_TYPE_DOUBLE}, FIELD_TYPE_BOOLEAN, sql_builtin_stub, NULL}, - {"LIKELY", 1, {FIELD_TYPE_ANY}, FIELD_TYPE_BOOLEAN, sql_builtin_stub, + {"LIKELY", 1, {field_type_MAX}, FIELD_TYPE_BOOLEAN, sql_builtin_stub, NULL}, {"LOWER", 1, {FIELD_TYPE_STRING}, FIELD_TYPE_STRING, LowerICUFunc, NULL}, @@ -2013,13 +2013,13 @@ static struct sql_func_definition definitions[] = { {"MIN", 1, {FIELD_TYPE_STRING}, FIELD_TYPE_STRING, step_minmax, NULL}, {"MIN", 1, {FIELD_TYPE_SCALAR}, FIELD_TYPE_SCALAR, step_minmax, NULL}, - {"NULLIF", 2, {FIELD_TYPE_ANY, FIELD_TYPE_ANY}, FIELD_TYPE_SCALAR, + {"NULLIF", 2, {field_type_MAX, field_type_MAX}, FIELD_TYPE_SCALAR, nullifFunc, NULL}, {"POSITION", 2, {FIELD_TYPE_STRING, FIELD_TYPE_STRING}, FIELD_TYPE_INTEGER, position_func, NULL}, - {"PRINTF", -1, {FIELD_TYPE_ANY}, FIELD_TYPE_STRING, printfFunc, + {"PRINTF", -1, {field_type_MAX}, FIELD_TYPE_STRING, printfFunc, NULL}, - {"QUOTE", 1, {FIELD_TYPE_ANY}, FIELD_TYPE_STRING, quoteFunc, NULL}, + {"QUOTE", 1, {field_type_MAX}, FIELD_TYPE_STRING, quoteFunc, NULL}, {"RANDOM", 0, {}, FIELD_TYPE_INTEGER, randomFunc, NULL}, {"RANDOMBLOB", 1, {FIELD_TYPE_INTEGER}, FIELD_TYPE_VARBINARY, randomBlob, NULL}, @@ -2062,10 +2062,10 @@ static struct sql_func_definition definitions[] = { {FIELD_TYPE_VARBINARY, FIELD_TYPE_INTEGER, FIELD_TYPE_VARBINARY}, FIELD_TYPE_VARBINARY, trim_func, NULL}, - {"TYPEOF", 1, {FIELD_TYPE_ANY}, FIELD_TYPE_STRING, typeofFunc, NULL}, + {"TYPEOF", 1, {field_type_MAX}, FIELD_TYPE_STRING, typeofFunc, NULL}, {"UNICODE", 1, {FIELD_TYPE_STRING}, FIELD_TYPE_INTEGER, unicodeFunc, NULL}, - {"UNLIKELY", 1, {FIELD_TYPE_ANY}, FIELD_TYPE_BOOLEAN, sql_builtin_stub, + {"UNLIKELY", 1, {field_type_MAX}, FIELD_TYPE_BOOLEAN, sql_builtin_stub, NULL}, {"UPPER", 1, {FIELD_TYPE_STRING}, FIELD_TYPE_STRING, UpperICUFunc, NULL}, @@ -2112,7 +2112,7 @@ built_in_func_put(struct sql_func_dictionary *dict) static inline bool is_exact(int op, enum field_type a, enum field_type b) { - return op == TK_NULL || a == b || a == FIELD_TYPE_ANY || + return op == TK_NULL || a == b || a == field_type_MAX || (a == FIELD_TYPE_INTEGER && b == FIELD_TYPE_UNSIGNED); } diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c index dc629aee3..f648c5d62 100644 --- a/src/box/sql/mem.c +++ b/src/box/sql/mem.c @@ -1489,7 +1489,7 @@ mem_cast_explicit(struct Mem *mem, enum field_type type) int mem_cast_implicit(struct Mem *mem, enum field_type type) { - if (mem->type == MEM_TYPE_NULL || type == FIELD_TYPE_ANY) + if (mem->type == MEM_TYPE_NULL || type == field_type_MAX) return 0; if ((mem->flags & MEM_Scalar) != 0 && type != FIELD_TYPE_SCALAR) return -1; -- 2.25.1