<HTML><BODY><div>Hi team, </div><div> </div><div>QA LGTM</div><div> </div><div> </div><div data-signature-widget="container"><div data-signature-widget="content"><div>--<br>Vitaliia Ioffe</div></div></div><div> </div><div> </div><blockquote style="border-left:1px solid #0857A6; margin:10px; padding:0 0 0 10px;">Пятница, 6 августа 2021, 9:46 +03:00 от Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org>:<br> <div id=""><div class="js-helper js-readmsg-msg"><div><div id="style_16282323820827207625_BODY">This patch removes functions that become unused due to changes of<br>implicit and explicit cast rules.<br><br>Closes #4470<br>---<br> src/box/sql/mem.c | 82 -----------------------------------------<br> src/box/sql/mem.h | 6 ---<br> src/box/sql/vdbe.h | 2 +-<br> src/box/sql/vdbeaux.c | 6 +--<br> src/box/sql/whereexpr.c | 4 +-<br> 5 files changed, 4 insertions(+), 96 deletions(-)<br><br>diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c<br>index e654cac41..d1ef92a86 100644<br>--- a/src/box/sql/mem.c<br>+++ b/src/box/sql/mem.c<br>@@ -1293,88 +1293,6 @@ mem_cast_implicit(struct Mem *mem, enum field_type type)<br> return -1;<br> }<br> <br>-int<br>-mem_cast_implicit_old(struct Mem *mem, enum field_type type)<br>-{<br>- if (mem->type == MEM_TYPE_NULL)<br>- return 0;<br>- switch (type) {<br>- case FIELD_TYPE_UNSIGNED:<br>- if (mem->type == MEM_TYPE_UINT)<br>- return 0;<br>- if (mem->type == MEM_TYPE_DOUBLE)<br>- return double_to_uint_precise(mem);<br>- if (mem->type == MEM_TYPE_STR)<br>- return str_to_uint(mem);<br>- return -1;<br>- case FIELD_TYPE_STRING:<br>- if ((mem->type & (MEM_TYPE_STR | MEM_TYPE_BIN)) != 0)<br>- return 0;<br>- if ((mem->type & (MEM_TYPE_INT | MEM_TYPE_UINT)) != 0)<br>- return int_to_str0(mem);<br>- if (mem->type == MEM_TYPE_DOUBLE)<br>- return double_to_str0(mem);<br>- if (mem->type == MEM_TYPE_UUID)<br>- return uuid_to_str0(mem);<br>- return -1;<br>- case FIELD_TYPE_DOUBLE:<br>- if (mem->type == MEM_TYPE_DOUBLE)<br>- return 0;<br>- if ((mem->type & (MEM_TYPE_INT | MEM_TYPE_UINT)) != 0)<br>- return int_to_double(mem);<br>- if (mem->type == MEM_TYPE_STR)<br>- return bin_to_str(mem);<br>- return -1;<br>- case FIELD_TYPE_INTEGER:<br>- if ((mem->type & (MEM_TYPE_INT | MEM_TYPE_UINT)) != 0)<br>- return 0;<br>- if (mem->type == MEM_TYPE_STR)<br>- return str_to_int(mem);<br>- if (mem->type == MEM_TYPE_DOUBLE)<br>- return double_to_int_precise(mem);<br>- return -1;<br>- case FIELD_TYPE_BOOLEAN:<br>- if (mem->type == MEM_TYPE_BOOL)<br>- return 0;<br>- return -1;<br>- case FIELD_TYPE_VARBINARY:<br>- if (mem->type == MEM_TYPE_BIN)<br>- return 0;<br>- if (mem->type == MEM_TYPE_UUID)<br>- return uuid_to_bin(mem);<br>- return -1;<br>- case FIELD_TYPE_NUMBER:<br>- if (mem_is_num(mem))<br>- return 0;<br>- if (mem->type == MEM_TYPE_STR)<br>- return mem_to_number(mem);<br>- return -1;<br>- case FIELD_TYPE_MAP:<br>- if (mem->type == MEM_TYPE_MAP)<br>- return 0;<br>- return -1;<br>- case FIELD_TYPE_ARRAY:<br>- if (mem->type == MEM_TYPE_ARRAY)<br>- return 0;<br>- return -1;<br>- case FIELD_TYPE_SCALAR:<br>- if ((mem->type & (MEM_TYPE_MAP | MEM_TYPE_ARRAY)) != 0)<br>- return -1;<br>- return 0;<br>- case FIELD_TYPE_UUID:<br>- if (mem->type == MEM_TYPE_UUID)<br>- return 0;<br>- if (mem->type == MEM_TYPE_STR)<br>- return str_to_uuid(mem);<br>- if (mem->type == MEM_TYPE_BIN)<br>- return bin_to_uuid(mem);<br>- return -1;<br>- default:<br>- break;<br>- }<br>- return -1;<br>-}<br>-<br> int<br> mem_cast_implicit_number(struct Mem *mem, enum field_type type)<br> {<br>diff --git a/src/box/sql/mem.h b/src/box/sql/mem.h<br>index 4f61cbab0..9681fc736 100644<br>--- a/src/box/sql/mem.h<br>+++ b/src/box/sql/mem.h<br>@@ -740,12 +740,6 @@ mem_cast_explicit(struct Mem *mem, enum field_type type);<br> int<br> mem_cast_implicit(struct Mem *mem, enum field_type type);<br> <br>-/**<br>- * Convert the given MEM to given type according to legacy implicit cast rules.<br>- */<br>-int<br>-mem_cast_implicit_old(struct Mem *mem, enum field_type type);<br>-<br> /**<br> * Cast MEM with numeric value to given numeric type. Doesn't fail. The return<br> * value is < 0 if the original value is less than the result, > 0 if the<br>diff --git a/src/box/sql/vdbe.h b/src/box/sql/vdbe.h<br>index 118f1cd83..be112c72d 100644<br>--- a/src/box/sql/vdbe.h<br>+++ b/src/box/sql/vdbe.h<br>@@ -266,7 +266,7 @@ sql *sqlVdbeDb(Vdbe *);<br> void sqlVdbeSetSql(Vdbe *, const char *z, int n);<br> void sqlVdbeSwap(Vdbe *, Vdbe *);<br> VdbeOp *sqlVdbeTakeOpArray(Vdbe *, int *, int *);<br>-sql_value *sqlVdbeGetBoundValue(Vdbe *, int, u8);<br>+sql_value *sqlVdbeGetBoundValue(Vdbe *, int);<br> char *sqlVdbeExpandSql(Vdbe *, const char *);<br> <br> /**<br>diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c<br>index 4a1fdb637..61be7b489 100644<br>--- a/src/box/sql/vdbeaux.c<br>+++ b/src/box/sql/vdbeaux.c<br>@@ -2323,17 +2323,15 @@ sqlVdbeDb(Vdbe * v)<br> * The returned value must be freed by the caller using sqlValueFree().<br> */<br> sql_value *<br>-sqlVdbeGetBoundValue(Vdbe * v, int iVar, u8 aff)<br>+sqlVdbeGetBoundValue(struct Vdbe *v, int iVar)<br> {<br> assert(iVar > 0);<br> if (v) {<br> Mem *pMem = &v->aVar[iVar - 1];<br> if (!mem_is_null(pMem)) {<br> sql_value *pRet = sqlValueNew(v->db);<br>- if (pRet) {<br>+ if (pRet != NULL)<br> mem_copy(pRet, pMem);<br>- mem_cast_implicit_old(pRet, aff);<br>- }<br> return pRet;<br> }<br> }<br>diff --git a/src/box/sql/whereexpr.c b/src/box/sql/whereexpr.c<br>index fe7329ea8..6849f13ec 100644<br>--- a/src/box/sql/whereexpr.c<br>+++ b/src/box/sql/whereexpr.c<br>@@ -309,9 +309,7 @@ like_optimization_is_valid(Parse *pParse, Expr *pExpr, Expr **ppPrefix,<br> if (op == TK_VARIABLE) {<br> Vdbe *pReprepare = pParse->pReprepare;<br> int iCol = pRight->iColumn;<br>- pVal =<br>- sqlVdbeGetBoundValue(pReprepare, iCol,<br>- FIELD_TYPE_SCALAR);<br>+ pVal = sqlVdbeGetBoundValue(pReprepare, iCol);<br> if (pVal != NULL && mem_is_str(pVal)) {<br> if (mem_as_str0(pVal) == NULL)<br> return -1;<br>--<br>2.25.1</div></div></div></div></blockquote><div> </div></BODY></HTML>