[tarantool-patches] Re: [PATCH 00/13] sql: support -2^63 .. 2^64-1 integer type

Stanislav Zudin szudin at tarantool.org
Mon Apr 1 23:38:19 MSK 2019



On 25.03.2019 18:10, n.pettik wrote:
> 
> 
>> On 15 Mar 2019, at 18:45, Stanislav Zudin <szudin at tarantool.org> wrote:
>>
>> The patch enables support of big integers in the range [2^63, 2^64-1].
>> Conversion functions use return value to inform about value
>> they return - signed integer in the range [-2^63,2^63-1] or
>> unsigned integer in the range [2^63, 2^64 -1].
>> The changes affect sql processing, VDBE, arithmetic functions and
>> aggregate functions.
> 
> I see a lot of commits below, so it would be nice to see
> some details concerning your plan of implementation.
> 
>> Issue: https://github.com/tarantool/tarantool/issues/3810
>> Branch: https://github.com/tarantool/tarantool/tree/stanztt/gh-3810-sql-uint64-support
> 
> I didn’t dive into your patches yet, but I’ve come up with
> simple and strange cases:
> 
> tarantool> CREATE TABLE t (id INT PRIMARY KEY, a INT);
> tarantool> box.space.T:insert{1, 18446744073709551615ULL}
> ---
> - [1, 18446744073709551615]
>> tarantool> SELECT a*1 FROM t;
> ---
> - error: 'Failed to execute SQL statement: integer is overflowed'
> ...
> tarantool> select a from t;
> ---
> - - [18446744073709551615]
>> 
> Or:
> 
> tarantool> select -9223372036854775808*(-1)
> ---
> - error: 'Failed to execute SQL statement: integer is overflowed'
> ...

Fixed.

> 
> Second example:
> 
> tarantool> format = {}
> tarantool> format[1] = {'a', 'integer'}
> tarantool> format[2] = {'b', 'unsigned’}
> 
> tarantool> box.schema.space.create('T1', {format = format})
> tarantool> box.space.T1:create_index('pk', {parts = {{'a'}}})
> 
> tarantool> box.sql.execute("insert into t1 values(18446744073709551615, 18446744073709551615)")
> ---
> ...
> 
> tarantool> box.sql.execute("select * from t1")
> ---
> - - [-1, 18446744073709551615]
>
Fixed.
The correct output is following:

tarantool> box.sql.execute("select * from t1")
---
- - [18446744073709551615, 18446744073709551615]
...


> 
> I expected that mentioned insertion would be equal to this one:
> 
> box.space.T1:insert({18446744073709551615ULL, 18446744073709551615ULL})
> 
> But instead, it is the same as:
> 
> box.space.T1:insert({18446744073709551615LL, 18446744073709551615ULL})
> 
> 
> 
> 




More information about the Tarantool-patches mailing list