Tarantool development patches archive
 help / color / mirror / Atom feed
From: imeevma@tarantool.org
To: v.shpilevoy@tarantool.org, tsafin@tarantool.org,
	tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v2 6/7] sql: remove OP_ApplyType
Date: Thu, 11 Jun 2020 15:54:16 +0300	[thread overview]
Message-ID: <699e6db0bed7c6af887c0cc0e5c861fbc5b2952b.1591878044.git.imeevma@gmail.com> (raw)
In-Reply-To: <cover.1591878044.git.imeevma@gmail.com>

Thank you for the review! My answer, diff and new patch below.

On 10.06.2020 01:29, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
>> diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c
>> index 1d7c76670..1ec9f4ed7 100644
>> --- a/src/box/sql/wherecode.c
>> +++ b/src/box/sql/wherecode.c
>> @@ -571,7 +571,7 @@ codeEqualityTerm(Parse * pParse,	/* The parsing context */
>>   *
>>   * Before returning, @types is set to point to a buffer containing a
>>   * copy of the column types array of the index allocated using
>> - * sqlDbMalloc(). This array is passed to OP_ApplyType to provide
>> + * sqlDbMalloc(). This array is passed to OP_CheckType to provide
>
> @types parameter does not exist anymore. I guess it was removed in
> one of the previous commits, and the comment should be updated there
> too.
>
Fixed.

>>   * correct implicit conversions.
>>   */
>>  static int



Diff:

diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c
index 1ec9f4ed7..2459054ff 100644
--- a/src/box/sql/wherecode.c
+++ b/src/box/sql/wherecode.c
@@ -568,11 +568,6 @@ codeEqualityTerm(Parse * pParse,	/* The parsing context */
  * key value of the loop.  If one or more IN operators appear, then
  * this routine allocates an additional nEq memory cells for internal
  * use.
- *
- * Before returning, @types is set to point to a buffer containing a
- * copy of the column types array of the index allocated using
- * sqlDbMalloc(). This array is passed to OP_CheckType to provide
- * correct implicit conversions.
  */
 static int
 codeAllEqualityTerms(Parse * pParse,	/* Parsing context */


New patch:

From 699e6db0bed7c6af887c0cc0e5c861fbc5b2952b Mon Sep 17 00:00:00 2001
From: Mergen Imeev <imeevma@gmail.com>
Date: Thu, 28 May 2020 13:03:37 +0300
Subject: [PATCH] sql: remove OP_ApplyType

Opcode OP_ApplyType is not needed now, so it should be removed.

Follow-up #4230

diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index a92c9f60f..e22ed98cf 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -2834,35 +2834,6 @@ case OP_Fetch: {
 	break;
 }
 
-/* Opcode: ApplyType P1 P2 * P4 *
- * Synopsis: type(r[P1@P2])
- *
- * Apply types to a range of P2 registers starting with P1.
- *
- * P4 is a string that is P2 characters long. The nth character of the
- * string indicates the column type that should be used for the nth
- * memory cell in the range.
- */
-case OP_ApplyType: {
-	enum field_type *types = pOp->p4.types;
-	assert(types != NULL);
-	assert(types[pOp->p2] == field_type_MAX);
-	pIn1 = &aMem[pOp->p1];
-	enum field_type type;
-	while((type = *(types++)) != field_type_MAX) {
-		assert(pIn1 <= &p->aMem[(p->nMem+1 - p->nCursor)]);
-		assert(memIsValid(pIn1));
-		if (mem_apply_type(pIn1, type) != 0) {
-			diag_set(ClientError, ER_SQL_TYPE_MISMATCH,
-				 sql_value_to_diag_str(pIn1),
-				 field_type_strs[type]);
-			goto abort_due_to_error;
-		}
-		pIn1++;
-	}
-	break;
-}
-
 /* Opcode: CheckType P1 P2 * P4 *
  * Synopsis: type(r[P1@P2])
  *
diff --git a/src/box/sql/wherecode.c b/src/box/sql/wherecode.c
index 1d7c76670..2459054ff 100644
--- a/src/box/sql/wherecode.c
+++ b/src/box/sql/wherecode.c
@@ -568,11 +568,6 @@ codeEqualityTerm(Parse * pParse,	/* The parsing context */
  * key value of the loop.  If one or more IN operators appear, then
  * this routine allocates an additional nEq memory cells for internal
  * use.
- *
- * Before returning, @types is set to point to a buffer containing a
- * copy of the column types array of the index allocated using
- * sqlDbMalloc(). This array is passed to OP_ApplyType to provide
- * correct implicit conversions.
  */
 static int
 codeAllEqualityTerms(Parse * pParse,	/* Parsing context */

  parent reply	other threads:[~2020-06-11 12:54 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-06-11 12:54 [Tarantool-patches] [PATCH v2 0/7] Remove implicit cast imeevma
2020-06-11 12:54 ` [Tarantool-patches] [PATCH v2 1/7] sql: remove implicit cast for assignment imeevma
2020-06-11 12:54 ` [Tarantool-patches] [PATCH v2 2/7] sql: remove mem_apply_type() from OP_MakeRecord imeevma
2020-06-11 12:54 ` [Tarantool-patches] [PATCH v2 3/7] sql: replace ApplyType by CheckType for IN operator imeevma
2020-06-11 12:54 ` [Tarantool-patches] [PATCH v2 4/7] sql: remove mem_apply_type() from OP_MustBeInt imeevma
2020-06-11 12:54 ` [Tarantool-patches] [PATCH v2 5/7] sql: remove implicit cast from string for comparison imeevma
2020-06-11 12:54 ` imeevma [this message]
2020-06-11 12:54 ` [Tarantool-patches] [PATCH v2 7/7] sql: use type instead of value in type mismatch error imeevma
2020-06-14 17:03   ` Vladislav Shpilevoy
2020-06-17 12:36 [Tarantool-patches] [PATCH v2 0/7] Remove implicit cast imeevma
2020-06-17 12:36 ` [Tarantool-patches] [PATCH v2 6/7] sql: remove OP_ApplyType imeevma

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=699e6db0bed7c6af887c0cc0e5c861fbc5b2952b.1591878044.git.imeevma@gmail.com \
    --to=imeevma@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --cc=tsafin@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 6/7] sql: remove OP_ApplyType' \
    /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