From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 541692DAF4 for ; Tue, 28 May 2019 07:31:51 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id zCYDrAsaL3WE for ; Tue, 28 May 2019 07:31:51 -0400 (EDT) Received: from smtp59.i.mail.ru (smtp59.i.mail.ru [217.69.128.39]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 1149A2DAA0 for ; Tue, 28 May 2019 07:31:50 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH 3/3] sql: fix passing FP values to integer iterator References: <789091b7acd99c908d26689f27c55f8b6dba3d16.1558700151.git.korablev@tarantool.org> <20190525055140.GA14501@atlas> <1fea92f3-20cc-d539-4010-0ef00b1b6c9a@tarantool.org> <20190528071951.GA31215@atlas> From: Vladislav Shpilevoy Message-ID: <385067fb-c47a-c5a8-064a-02ef7f906c92@tarantool.org> Date: Tue, 28 May 2019 14:31:44 +0300 MIME-Version: 1.0 In-Reply-To: <20190528071951.GA31215@atlas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Konstantin Osipov Cc: tarantool-patches@freelists.org, Nikita Pettik On 28/05/2019 10:19, Konstantin Osipov wrote: > * Vladislav Shpilevoy [19/05/28 09:22]: >> On 25/05/2019 08:51, Konstantin Osipov wrote: >>> * Nikita Pettik [19/05/24 20:42]: >>>> That happened due to the fact that type casting mechanism (OP_ApplyType) >>>> doesn't affect FP value when it is converted to integer. Hence, FP value >>>> was passed to the iterator over integer field which resulted in error. >>>> Meanwhile, comparison of integer and FP values is legal in SQL. To cope >>>> with this problem for each equality comparison involving integer field >>>> we emit OP_MustBeInt, which checks whether value to be compared is >>>> integer or not. If the latter, we assume that result of comparison is >>>> always false and continue processing query. >>> >>> Are you sure other vendords would fail to return any results for >>> WHERE foo = 1.0? >> >> I do not understand, what you are talking about. It works. > > Is this with the patch applied? I do not know, and it does not matter, IMO. With the patch it works. > >> >> tarantool> box.execute("CREATE TABLE t1(id INT PRIMARY KEY, a INT UNIQUE);") >> tarantool> box.execute("INSERT INTO t1 VALUES (1, 1);") >> tarantool> box.execute("SELECT a FROM t1 WHERE a = 1.0;") > > I don't understand how it works then. > a = 1.0 works but a = 1.1 doesn't? Yes, it is a school math. 1 != 1.1, but 1 == 1.0