[Tarantool-patches] [PATCH v1 1/1] sql: remove OP_Realify

Vitaliia Ioffe v.ioffe at tarantool.org
Wed Aug 4 19:11:55 MSK 2021


Hi team, 
 
QA LGTM
 
 
--
Vitaliia Ioffe
 
  
>Среда, 4 августа 2021, 17:08 +03:00 от Kirill Yukhin via Tarantool-patches <tarantool-patches at dev.tarantool.org>:
> 
>Hello,
>
>On 04 авг 11:30,  imeevma at tarantool.org wrote:
>> This opcode was used to convert INTEGER values to REAL. It is not
>> necessary in Tarantool and causes errors.
>>
>> Due to OP_Realify two type of errors appeared:
>> 1) In some cases in trigger INTEGER may be converted to DOUBLE.
>> For example:
>> box.execute("CREATE TABLE t (i NUMBER PRIMARY KEY, n NUMBER);")
>> box.execute("CREATE TRIGGER t AFTER INSERT ON t FOR EACH ROW BEGIN UPDATE t SET n = new.n; END;")
>> box.execute("INSERT INTO t VALUES (1, 1);")
>> box.execute("SELECT i / 2, n / 2 FROM t;")
>>
>> Result:
>> tarantool> box.execute("SELECT i / 2, n / 2 FROM t;")
>> ---
>> - metadata:
>> - name: COLUMN_1
>> type: number
>> - name: COLUMN_2
>> type: number
>> rows:
>> - [0, 0.5]
>> ...
>>
>> 2) If SELECT uses GROUP BY then it may return DOUBLE instead of INTEGER.
>> For example:
>> box.execute("CREATE TABLE t (i NUMBER PRIMARY KEY, n NUMBER);")
>> box.execute("INSERT INTO t VALUES (1,1);")
>> box.execute("SELECT i / 2, n / 2 FROM t GROUP BY n;")
>>
>> Result:
>> tarantool> box.execute("SELECT i / 2, n / 2 FROM t GROUP BY n;")
>> ---
>> - metadata:
>> - name: COLUMN_1
>> type: number
>> - name: COLUMN_2
>> type: number
>> rows:
>> - [0.5, 0.5]
>> ...
>>
>> This patch removes OP_Realify, after which these errors disappear.
>>
>> Closes #5335
>> ---
>>  https://github.com/tarantool/tarantool/issues/5335
>>  https://github.com/tarantool/tarantool/tree/imeevma/gh-5335-remove-op-realify
>The patch LGTM.
>
>--
>Regards, Kirill Yukhin
 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.tarantool.org/pipermail/tarantool-patches/attachments/20210804/c2a200de/attachment.htm>


More information about the Tarantool-patches mailing list