[tarantool-patches] Re: [PATCH 3/3] sql: fix passing FP values to integer iterator

  • From: Vladislav Shpilevoy <v.shpilevoy@xxxxxxxxxxxxx>
  • To: Konstantin Osipov <kostja@xxxxxxxxxxxxx>
  • Date: Tue, 28 May 2019 14:31:44 +0300



On 28/05/2019 10:19, Konstantin Osipov wrote:

* Vladislav Shpilevoy <v.shpilevoy@xxxxxxxxxxxxx> [19/05/28 09:22]:
On 25/05/2019 08:51, Konstantin Osipov wrote:
* Nikita Pettik <korablev@xxxxxxxxxxxxx> [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


Other related posts: