From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from smtp44.i.mail.ru (smtp44.i.mail.ru [94.100.177.104]) (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 84E514696C3 for ; Mon, 27 Apr 2020 04:34:29 +0300 (MSK) Date: Mon, 27 Apr 2020 01:34:28 +0000 From: Nikita Pettik Message-ID: <20200427013428.GB28450@tarantool.org> References: <1c1301d61489$a1af1790$e50d46b0$@tarantool.org> <8A7E5353-3471-4B54-91F7-F35AB4A4B039@tarantool.org> <1e3201d614ae$8cc16d40$a64447c0$@tarantool.org> <2D88A96E-5B9A-418C-8DD1-BB9BFD1EDD57@tarantool.org> <203801d61562$5ce44390$16accab0$@tarantool.org> <610CF1D6-A724-4BE2-A717-C3F44A733D7A@tarantool.org> <20200420010518.GA25021@tarantool.org> <1207B8C8-659E-44EB-80F1-9ABBF6B65FA1@tarantool.org> <20200420235706.GA28948@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: Subject: Re: [Tarantool-patches] [PATCH] sql: fix number and boolean sorting rules List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Roman Khabibov Cc: tarantool-patches@dev.tarantool.org On 24 Apr 16:03, Roman Khabibov wrote: > Hi! Thanks for the review. > > > On Apr 21, 2020, at 02:57, Nikita Pettik wrote: > > > > On 20 Apr 23:28, Roman Khabibov wrote: Pushed to master and 2.3 with fixes attached below. Changelogs are not updated due to the lack of drafts on github. Branch has been dropped. diff --git a/src/box/sql/vdbeaux.c b/src/box/sql/vdbeaux.c index 310cec3ed..71f694b20 100644 --- a/src/box/sql/vdbeaux.c +++ b/src/box/sql/vdbeaux.c @@ -3053,8 +3053,9 @@ sqlVdbeCompareMsgpack(const char **key1, } else if ((pKey2->flags & MEM_Real) != 0) { rc = double_compare_uint64(pKey2->u.r, mem1.u.u, -1); - } else if ((pKey2->flags & MEM_Null) != 0 || - (pKey2->flags & MEM_Bool) != 0) { + } else if ((pKey2->flags & MEM_Null) != 0) { + rc = 1; + } else if ((pKey2->flags & MEM_Bool) != 0) { rc = 1; } else { rc = -1; @@ -3074,8 +3075,9 @@ sqlVdbeCompareMsgpack(const char **key1, } else if (pKey2->flags & MEM_Real) { rc = double_compare_uint64(-pKey2->u.r, -mem1.u.i, 1); - } else if ((pKey2->flags & MEM_Null) != 0 || - (pKey2->flags & MEM_Bool) != 0) { + } else if ((pKey2->flags & MEM_Null) != 0) { + rc = 1; + } else if ((pKey2->flags & MEM_Bool) != 0) { rc = 1; } else { rc = -1; @@ -3101,9 +3103,12 @@ sqlVdbeCompareMsgpack(const char **key1, } else if (mem1.u.r > pKey2->u.r) { rc = +1; } + } else if ((pKey2->flags & MEM_Null) != 0) { + rc = 1; + } else if ((pKey2->flags & MEM_Bool) != 0) { + rc = 1; } else { - rc = (pKey2->flags & MEM_Null) != 0 || - (pKey2->flags & MEM_Bool) != 0 ? 1 : -1; + rc = -1; } break;