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

Konstantin Osipov kostja at tarantool.org
Tue May 28 10:19:51 MSK 2019


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

> 
> 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?


-- 
Konstantin Osipov, Moscow, Russia




More information about the Tarantool-patches mailing list