Tarantool development patches archive
 help / color / mirror / Atom feed
From: Mergen Imeev via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: Vladislav Shpilevoy <v.shpilevoy@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 4/4] sql: introduce mem_cmp_msgpack()
Date: Wed, 14 Jul 2021 09:51:37 +0300	[thread overview]
Message-ID: <20210714065137.GA7470@tarantool.org> (raw)
In-Reply-To: <e4d92e08-16ee-3717-4a8b-aeae7b4d018a@tarantool.org>

Hi! Thank you for the review! My answers and diff below.

On Tue, Jul 13, 2021 at 10:39:04PM +0200, Vladislav Shpilevoy wrote:
> Thanks for the fixes!
> 
> > diff --git a/src/box/sql.c b/src/box/sql.c
> > index 790ca7f70..c1271ee0a 100644
> > --- a/src/box/sql.c
> > +++ b/src/box/sql.c
> > @@ -765,10 +765,14 @@ tarantoolsqlIdxKeyCompare(struct BtCursor *cursor,
> >  			}
> >  		}
> >  		next_fieldno = fieldno + 1;
> > -		rc = sqlVdbeCompareMsgpack(&p, unpacked, i);
> > +		struct key_part *part = &unpacked->key_def->parts[i];
> > +		struct Mem *mem = unpacked->aMem + i;
> > +		struct coll *coll = part->coll;
> > +		/* In case of fail make rc equal to 0. */
> 
> The comment isn't really necessary I would say. Does not
> help much. The same in the other place below.
> 
Dropped.

> > +		if (mem_cmp_msgpack(mem, &p, &rc, coll) != 0)
> > +			rc = 0;
> >  		if (rc != 0) {
> > -			if (unpacked->key_def->parts[i].sort_order !=
> > -			    SORT_ORDER_ASC)
> > +			if (part->sort_order == SORT_ORDER_ASC)
> 
> Why did you change != to ==?
> 
I did this because function sqlVdbeCompareMsgpack() compared packed value as
left operand and MEM as right operand. In mem_cmp_msgpack() order was reversed,
now MEM is left operand and packed value is right operand.

> > diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
> > index da27cd191..8e176e418 100644
> > --- a/src/box/sql/mem.c
> > +++ b/src/box/sql/mem.c
> > @@ -2721,13 +2586,16 @@ sqlVdbeRecordCompareMsgpack(const void *key1,
> >  	n = MIN(n, key2->nField);
> >  
> >  	for (i = 0; i != n; i++) {
> > -		rc = sqlVdbeCompareMsgpack((const char**)&key1, key2, i);
> > +		struct key_part *part = &key2->key_def->parts[i];
> > +		struct Mem *mem = key2->aMem + i;
> > +		struct coll *coll = part->coll;
> > +		/* In case of fail make rc equal to 0. */
> > +		if (mem_cmp_msgpack(mem, (const char **)&key1, &rc, coll) != 0)
> > +			rc = 0;



Diff:


diff --git a/src/box/sql.c b/src/box/sql.c
index c1271ee0a..7471c3832 100644
--- a/src/box/sql.c
+++ b/src/box/sql.c
@@ -768,7 +768,6 @@ tarantoolsqlIdxKeyCompare(struct BtCursor *cursor,
 		struct key_part *part = &unpacked->key_def->parts[i];
 		struct Mem *mem = unpacked->aMem + i;
 		struct coll *coll = part->coll;
-		/* In case of fail make rc equal to 0. */
 		if (mem_cmp_msgpack(mem, &p, &rc, coll) != 0)
 			rc = 0;
 		if (rc != 0) {
diff --git a/src/box/sql/mem.c b/src/box/sql/mem.c
index 8e176e418..62993fa4f 100644
--- a/src/box/sql/mem.c
+++ b/src/box/sql/mem.c
@@ -2589,7 +2589,6 @@ sqlVdbeRecordCompareMsgpack(const void *key1,
 		struct key_part *part = &key2->key_def->parts[i];
 		struct Mem *mem = key2->aMem + i;
 		struct coll *coll = part->coll;
-		/* In case of fail make rc equal to 0. */
 		if (mem_cmp_msgpack(mem, (const char **)&key1, &rc, coll) != 0)
 			rc = 0;
 		if (rc != 0) {

  reply	other threads:[~2021-07-14  6:51 UTC|newest]

Thread overview: 21+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-10 14:33 [Tarantool-patches] [PATCH v2 0/4] Follow ups for uuid introduction Mergen Imeev via Tarantool-patches
2021-07-10 14:33 ` [Tarantool-patches] [PATCH v2 1/4] sql: introduce uuid to quote() Mergen Imeev via Tarantool-patches
2021-07-10 14:33 ` [Tarantool-patches] [PATCH v2 2/4] sql: allow to bind uuid values Mergen Imeev via Tarantool-patches
2021-07-10 14:33 ` [Tarantool-patches] [PATCH v2 3/4] sql: introduce mem_cmp_scalar() Mergen Imeev via Tarantool-patches
2021-07-11 15:03   ` Vladislav Shpilevoy via Tarantool-patches
2021-07-11 17:51     ` Mergen Imeev via Tarantool-patches
2021-07-12 21:06       ` Vladislav Shpilevoy via Tarantool-patches
2021-07-13  8:04         ` Mergen Imeev via Tarantool-patches
2021-07-10 14:33 ` [Tarantool-patches] [PATCH v2 4/4] sql: introduce mem_cmp_msgpack() Mergen Imeev via Tarantool-patches
2021-07-11 15:05   ` Vladislav Shpilevoy via Tarantool-patches
2021-07-11 17:59     ` Mergen Imeev via Tarantool-patches
2021-07-12 21:09       ` Vladislav Shpilevoy via Tarantool-patches
2021-07-13  8:10         ` Mergen Imeev via Tarantool-patches
2021-07-13 20:39           ` Vladislav Shpilevoy via Tarantool-patches
2021-07-14  6:51             ` Mergen Imeev via Tarantool-patches [this message]
2021-07-14 21:53               ` Vladislav Shpilevoy via Tarantool-patches
2021-07-15  6:58                 ` Mergen Imeev via Tarantool-patches
2021-07-15 20:44 ` [Tarantool-patches] [PATCH v2 0/4] Follow ups for uuid introduction Vladislav Shpilevoy via Tarantool-patches
2021-07-16  8:57 Mergen Imeev via Tarantool-patches
2021-07-16  8:57 ` [Tarantool-patches] [PATCH v2 4/4] sql: introduce mem_cmp_msgpack() Mergen Imeev via Tarantool-patches
2021-07-19  9:16   ` Timur Safin via Tarantool-patches
2021-07-19 10:07     ` Mergen Imeev via Tarantool-patches

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=20210714065137.GA7470@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 4/4] sql: introduce mem_cmp_msgpack()' \
    /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