Tarantool development patches archive
 help / color / mirror / Atom feed
From: Serge Petrenko via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH 1/1] box: make UUID part of SCALAR
Date: Sun, 25 Apr 2021 12:07:25 +0300	[thread overview]
Message-ID: <4d65f57c-2477-c95a-f199-0af890ae148a@tarantool.org> (raw)
In-Reply-To: <c2a4b6f94b1cb336f689c5aa7f26a14208fa3fd2.1619177960.git.imeevma@gmail.com>



23.04.2021 14:40, imeevma@tarantool.org пишет:
> Prior to this patch, UUID was not part of SCALAR. However, this should
> be changed to comply with the RFC "Consistent Lua/SQL types".
>
> Closes #6042
>
> @TarantoolBot document
> Title: UUID is now part of SCALAR
>
> The UUID field type is now part of the SCALAR field type. This means
> that now values of type UUID can be inserted into the SCALAR field, and
> these values can participate in the sorting of the SCALAR fields. The
> order is as follows: boolean < number < string < varbinary < uuid.
> ---

Thanks for the patch!
Generally LGTM with 2 comments.

> https://github.com/tarantool/tarantool/issues/6042
> https://github.com/tarantool/tarantool/tree/imeevma/gh-6042-make-uuid-part-of-scalar
>
>   .../unreleased/make-uuid-part-of-scalar.md    |  3 ++
>   src/box/field_def.c                           |  2 +-
>   src/box/tuple_compare.cc                      |  2 +
>   test/app/uuid.result                          | 46 +++++++++++++++++++
>   test/app/uuid.test.lua                        | 18 ++++++++
>   test/engine/ddl.result                        |  4 +-
>   test/engine/ddl.test.lua                      |  2 +-
>   7 files changed, 72 insertions(+), 5 deletions(-)
>   create mode 100644 changelogs/unreleased/make-uuid-part-of-scalar.md
>

...


> diff --git a/test/app/uuid.test.lua b/test/app/uuid.test.lua
> index 867bbd832..7c0942fd6 100644
> --- a/test/app/uuid.test.lua
> +++ b/test/app/uuid.test.lua
> @@ -164,6 +164,24 @@ u1 = nil
>   u1_str = nil
>   u2_str = nil
>   
> +--
> +-- gh-6042: add UUID to SCALAR.
> +--
> +s = box.schema.space.create('s', {format={{'s', 'scalar'}}})
> +_ = s:create_index('i')
> +s:insert({1})
> +s:insert({'1'})
> +s:insert({uuid.fromstr('11111111-1111-1111-1111-111111111111')})
> +s:insert({uuid.fromstr('11111111-1111-2222-1111-111111111111')})
> +
> +--
> +-- Make sure that comparison in right. Comparison in SCALAR field:
> +-- bool < number < string < varbinary < uuid.
> +--

I'd also insert a varbinary value to the index, just to check.
Is it possible from lua?

> +s:select()
> +s:select({}, {iterator='LE'})
> +s:drop()
> +
>   uuid = nil
>   
>   test_run:cmd("clear filter")
> diff --git a/test/engine/ddl.result b/test/engine/ddl.result
> index 08ad1a57b..e044bc094 100644
> --- a/test/engine/ddl.result
> +++ b/test/engine/ddl.result
> @@ -1429,10 +1429,8 @@ fail_format_change(12, 'number')
>     number, got extension'
>   ...
>   -- uuid --X--> scalar

The comment should be "-- uuid -----> scalar" now.

> -fail_format_change(12, 'scalar')
> +ok_format_change(12, 'scalar')
>   ---
> -- 'Tuple field 12 (field12) type does not match one required by operation: expected
> -  scalar, got extension'
>   ...
>   -- uuid --X--> string
>   fail_format_change(12, 'string')
> diff --git a/test/engine/ddl.test.lua b/test/engine/ddl.test.lua
> index 5ba80e075..0cf25aa46 100644
> --- a/test/engine/ddl.test.lua
> +++ b/test/engine/ddl.test.lua
> @@ -523,7 +523,7 @@ ok_format_change(12, 'any')
>   -- uuid --X--> number
>   fail_format_change(12, 'number')
>   -- uuid --X--> scalar
> -fail_format_change(12, 'scalar')
> +ok_format_change(12, 'scalar')
>   -- uuid --X--> string
>   fail_format_change(12, 'string')
>   -- uuid --X--> integer

-- 
Serge Petrenko


  reply	other threads:[~2021-04-25  9:07 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-04-23 11:40 Mergen Imeev via Tarantool-patches
2021-04-25  9:07 ` Serge Petrenko via Tarantool-patches [this message]
2021-04-26 15:31   ` Mergen Imeev via Tarantool-patches
2021-04-28 14:43     ` Serge Petrenko via Tarantool-patches
2021-05-16  9:31 Mergen Imeev via Tarantool-patches
2021-05-19 10:48 ` Mergen Imeev via Tarantool-patches
2021-05-21 19:09 ` Vladislav Shpilevoy via Tarantool-patches
2021-05-24  9:49 ` Kirill Yukhin via Tarantool-patches

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=4d65f57c-2477-c95a-f199-0af890ae148a@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=sergepetrenko@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH 1/1] box: make UUID part of SCALAR' \
    /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