From: Igor Munkin <imun@tarantool.org>
To: olegrok@tarantool.org
Cc: tarantool-patches@dev.tarantool.org, v.shpilevoy@tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 1/2] uuid: support comparison of uuid values in Lua
Date: Tue, 24 Nov 2020 18:20:43 +0300 [thread overview]
Message-ID: <20201124152043.GE14086@tarantool.org> (raw)
In-Reply-To: <f2b6f003939881319d086af9738190b869693eb9.1605685304.git.babinoleg@mail.ru>
Oleg,
Thanks for the patch! Considering the version on the remote branch, LGTM
except a single nit below.
On 18.11.20, olegrok@tarantool.org wrote:
> From: Oleg Babin <babinoleg@mail.ru>
>
> Since Tarantool has uuid data type sometimes we want to compare
> uuid vaues as it's possible for primitive types and decimals. This
> patch exports function for uuid comparison and implements le and
> lt metamethods for uuid type.
Minor: Strictly saying, you're right, but AFAICS we usually use the key
name (i.e. __le and __lt) for metamethods in description.
>
> Closes #5511
>
> @TarantoolBot document
> Title: uuid comparison is supported
>
> Currently comparison between uuid values is supported.
> Example:
> ```lua
> 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
> ```
> ---
> Issue: https://github.com/tarantool/tarantool/issues/5511
> Branch: https://github.com/tarantool/tarantool/tree/olegrok/5511-uuid-cmp-v2
>
> src/exports.h | 1 +
> src/lua/uuid.lua | 25 +++++++++++++
> test/app/uuid.result | 79 ++++++++++++++++++++++++++++++++++++++++++
> test/app/uuid.test.lua | 29 ++++++++++++++++
> 4 files changed, 134 insertions(+)
>
<snipped>
> diff --git a/src/lua/uuid.lua b/src/lua/uuid.lua
> index 42016601d..08991cfeb 100644
> --- a/src/lua/uuid.lua
> +++ b/src/lua/uuid.lua
<snipped>
> +local uuid_lt = function(lhs, rhs)
> + return uuid_cmp(lhs, rhs) < 0
> +end
> +local uuid_le = function(lhs, rhs)
> + return uuid_cmp(lhs, rhs) <= 0
> +end
Side note: I see no reason to define these oneline functions (you can
simply store an anonymous function right to the metatable), but I see
them everywhere in Tarantool sources, so feel free to ignore this note.
> +
<snipped>
> --
> 2.29.0
>
--
Best regards,
IM
next prev parent reply other threads:[~2020-11-24 15:20 UTC|newest]
Thread overview: 21+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-18 7:56 [Tarantool-patches] [PATCH v2 0/2] Make uuid values comparable olegrok
2020-11-18 7:56 ` [Tarantool-patches] [PATCH v2 1/2] uuid: support comparison of uuid values in Lua olegrok
2020-11-21 15:17 ` Vladislav Shpilevoy
2020-11-21 19:07 ` Oleg Babin
2020-11-23 21:58 ` Vladislav Shpilevoy
2020-11-24 5:57 ` Oleg Babin
2020-11-24 13:06 ` Igor Munkin
2020-11-27 15:17 ` Oleg Babin
2020-11-24 15:20 ` Igor Munkin [this message]
2020-11-24 19:23 ` Oleg Babin
2020-11-18 7:56 ` [Tarantool-patches] [PATCH v2 2/2] uuid: support uuid comparison with strings olegrok
2020-11-21 15:17 ` Vladislav Shpilevoy
2020-11-21 19:07 ` Oleg Babin
2020-11-24 15:20 ` Igor Munkin
2020-11-24 19:23 ` Oleg Babin
2020-11-18 8:02 ` [Tarantool-patches] [PATCH v2 0/2] Make uuid values comparable Oleg Babin
2020-11-27 22:39 ` Vladislav Shpilevoy
2020-11-27 22:40 ` Vladislav Shpilevoy
2020-12-04 8:13 ` Oleg Babin
2020-12-07 23:04 ` Alexander V. Tikhonov
2020-12-07 23:24 ` Vladislav Shpilevoy
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20201124152043.GE14086@tarantool.org \
--to=imun@tarantool.org \
--cc=olegrok@tarantool.org \
--cc=tarantool-patches@dev.tarantool.org \
--cc=v.shpilevoy@tarantool.org \
--subject='Re: [Tarantool-patches] [PATCH v2 1/2] uuid: support comparison of uuid values in Lua' \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox