[Tarantool-patches] [PATCH v2 2/2] uuid: support uuid comparison with strings
olegrok at tarantool.org
Sat Nov 21 22:07:47 MSK 2020
Hi! Thanks for your comments. See my answers below.
On 21/11/2020 18:17, Vladislav Shpilevoy wrote:
> Thanks for the patch!
> See 2 comments below.
> On 18.11.2020 08:56,olegrok at tarantool.org wrote:
>> From: Oleg Babin<babinoleg at mail.ru>
>> Before this patch it was impossible to compare uuid values with
>> string representations of uuid. However we have cases when such
>> comparisons is possible (e.g. "decimal" where we can compare
>> decimal values with strings and numbers).
>> This patch extends uuid comparators (eq, lt, le) and every string
>> argument is tried to be converted to uuid value to compare then.
>> Follow-up #5511
>> @TarantoolBot document
>> Title: uuid values could be compared with strings
>> Currently it's possible to compare uuid values with its string
>> u1_str = 'aaaaaaaa-aaaa-4000-b000-000000000001'
>> u1 = uuid.fromstr(u1_str)
>> u2_str = 'bbbbbbbb-bbbb-4000-b000-000000000001'
>> u1 == u1_str -- true
>> u1 == u2_str -- false
>> u1 >= u1_str -- true
>> u1 < u2_str -- true
> 1. Better use a single docbot request. It will be simpler for the doc
> team to handle it, since both the updates are about the same place.
> But up to you.
Agree. I've merged them.
Title: uuid comparison rules
Currently comparison between uuid values is supported.
u1 = uuid.fromstr('aaaaaaaa-aaaa-4000-b000-000000000001')
u2 = uuid.fromstr('bbbbbbbb-bbbb-4000-b000-000000000001')
u1 > u2 -- false
u1 >= u2 -- false
u1 <= u2 -- true
u1 < u2 -- true
Also it's possible to compare uuid values with its string
u1_str = 'aaaaaaaa-aaaa-4000-b000-000000000001'
u1 = uuid.fromstr(u1_str)
u2_str = 'bbbbbbbb-bbbb-4000-b000-000000000001'
u1 == u1_str -- true
u1 == u2_str -- false
u1 >= u1_str -- true
u1 < u2_str -- true
>> diff --git a/test/app/uuid.result b/test/app/uuid.result
>> index e06331001..5b9ffa230 100644
>> --- a/test/app/uuid.result
>> +++ b/test/app/uuid.result
> 2. I don't see a test for == with an incorrect string. Is it
Yes, it was added before
More information about the Tarantool-patches