Tarantool development patches archive
 help / color / mirror / Atom feed
From: Stanislav Zudin <szudin@tarantool.org>
To: tarantool-patches@freelists.org
Cc: Vladimir Davydov <vdavydov.dev@gmail.com>
Subject: Re: [tarantool-patches] Re: [PATCH v2] Feature request for a new collation
Date: Thu, 28 Feb 2019 15:14:51 +0300	[thread overview]
Message-ID: <230d10ab-6b3c-f5c0-853c-d48624a8cf4f@tarantool.org> (raw)
In-Reply-To: <20190226135217.a4ptsoxgkk35b7m2@esperanza>

The recent patch includes the updated tests and new name for the collation.


On 26.02.2019 16:52, Vladimir Davydov wrote:
> IMO the subject line would be more descriptive if it read
>
>    box: add new unicode_s2 collation
>
> On Tue, Feb 26, 2019 at 01:40:42PM +0300, Stanislav Zudin wrote:
>> Adds a new default collation 'unicode_s2' to support the difference
>> between Cyrillic letters 'Е' and 'Ё'. The standard case insensitive
>> collation ('unicode_ci') doesn't distinguish these letters.
>>
>> Closes #4007
>> ---
>> Branch: https://github.com/tarantool/tarantool/tree/stanztt/gh-4007-new-default-collation-2.1
>> Issue: https://github.com/tarantool/tarantool/issues/4007
>>
>>   src/box/bootstrap.snap          | Bin 1831 -> 1864 bytes
>>   src/box/lua/upgrade.lua         |   1 +
>>   test/sql-tap/collation.test.lua |   7 +-
>>   test/sql/collation.result       | 111 ++++++++++++++++++++++++++++++++
>>   test/sql/collation.test.lua     |  41 ++++++++++++
>>   5 files changed, 157 insertions(+), 3 deletions(-)
> Tests still don't pass:
>
> https://travis-ci.org/tarantool/tarantool/builds/498654717?utm_source=github_status&utm_medium=notification
>
> Please fix.
Fixed
>
>> diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua
>> index 70cfb4f2e..84c559dac 100644
>> --- a/src/box/lua/upgrade.lua
>> +++ b/src/box/lua/upgrade.lua
>> @@ -610,6 +610,7 @@ local function upgrade_to_2_1_0()
> As I said, we're about to release 2.1.2 so you should add
> upgrade_to_2_1_2 and add the collation there.
done
>>   
>>       box.space._collation:replace{0, "none", ADMIN, "BINARY", "", setmap{}}
>>       box.space._collation:replace{3, "binary", ADMIN, "BINARY", "", setmap{}}
>> +    box.space._collation:replace{4, "unicode_s2", ADMIN, "ICU", "ru_RU", {strength='secondary'}}
> As I mentioned earlier, name unicode_s2 looks way too generic for
> ru locale. IMO we should either use unicode_ru_s2 or unicode_ru.
> Also, currently we don't use s1/s2/s3 suffixes. Instead we used cs/ci.
> May be, we should use a suffix like that in this case too.
>
> I looked through Kostja's discussion with Mr. Gulutzan and I didn't
> see that they had come to an agreement to name this new collation
> unicode_s2. Please solicit their approval on the name.
Renamed to unicode_ru_s2.

The updated patch is below:

Branch: 
https://github.com/tarantool/tarantool/tree/stanztt/gh-4007-new-default-collation-2.1
Issue: https://github.com/tarantool/tarantool/issues/4007

  src/box/bootstrap.snap          | Bin 1831 -> 1867 bytes
  src/box/lua/upgrade.lua         |   7 +-
  test/box/ddl.result             |  14 ++--
  test/box/net.box.result         |   2 +-
  test/sql-tap/collation.test.lua |   7 +-
  test/sql/collation.result       | 111 ++++++++++++++++++++++++++++++++
  test/sql/collation.test.lua     |  41 ++++++++++++
  7 files changed, 171 insertions(+), 11 deletions(-)

diff --git a/src/box/bootstrap.snap b/src/box/bootstrap.snap
index 
0bb446fb6903ac3ef630c419b909f7db3df0372a..a0c436d0dac9593d88e87fefe5084e833d8bed2f 
100644
GIT binary patch
delta 1863
zcmV-N2e|mB4$BUZ8Gkb|I4x&pGBIUjVP#}63Q2BrbYX5|WjY`?GG;S1Fgau`GcYnT
zEi^JQVJ%@eWic%_G&x}~IWsq8Ffup_RzqxWV{1AfdmtbnARr)p3JTS_3%bn)%K*;U
z5SneJ0000004TLD{QyuEHUN4^h!07?SWN>cqM|H{q9~%Gb$^TUh>GZvX5Gkcfo*0U
z^Ec&r*()=!Gn3-3q)ZYae>Wl1Q4$JjYudtRaDrKA3;S4dr=roZF%c_L2HybK0OkNL
z@s({XeEpHwDqqd_XaqwdiFoT<qHR5^+jTZ!23W1F_!#V5%p1qN&#Sw0r#<-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EnR68??zGSv7f?8y1z%Mw_woZ)_#d6LLT2tbG!rMPqA;^9qOVp6)w)Uk3
zWj-M@9sOHqC33{?D9#~wr0H7TN8Lc)Ob&^*Dez)Cm?wW<i_>jj;1n9Cw{1vsrpxC{
z>={t>jCkioCWhRtm4EX|*239%3IO;oK41!#Ues%p1qCUL?4u+<m}YW<L(kyhjyf?G
zTJAly-7>J7ywZd0|9Dm~is&PHOHUGW6(y5)oZ3z2@GO5Ksw8hRS@Hb?aZr+0cGNIK
z43t=2$s?w>#u23tKrzBb1(Hfa^nV<p45fgF?oxj_`)Ep_UK{`xaiyL&vvbKES-e0i
R9JX=Dom4Gm<qp*lt?k>YT~h!6

diff --git a/src/box/lua/upgrade.lua b/src/box/lua/upgrade.lua
index 70cfb4f2e..09af2e20d 100644
--- a/src/box/lua/upgrade.lua
+++ b/src/box/lua/upgrade.lua
@@ -614,6 +614,10 @@ local function upgrade_to_2_1_0()
      upgrade_priv_to_2_1_0()
  end

+local function upgrade_to_2_1_2()
+    box.space._collation:replace{4, "unicode_ru_s2", ADMIN, "ICU", 
"ru_RU", {strength='secondary'}}
+end
+
  local function get_version()
      local version = box.space._schema:get{'version'}
      if version == nil then
@@ -641,7 +645,8 @@ local function upgrade(options)
          {version = mkversion(1, 7, 7), func = upgrade_to_1_7_7, auto = 
true},
          {version = mkversion(1, 10, 0), func = upgrade_to_1_10_0, auto 
= true},
          {version = mkversion(1, 10, 2), func = upgrade_to_1_10_2, auto 
= true},
-        {version = mkversion(2, 1, 0), func = upgrade_to_2_1_0, auto = 
true}
+        {version = mkversion(2, 1, 0), func = upgrade_to_2_1_0, auto = 
true},
+        {version = mkversion(2, 1, 2), func = upgrade_to_2_1_2, auto = 
true}
      }

      for _, handler in ipairs(handlers) do
diff --git a/test/box/ddl.result b/test/box/ddl.result
index 3d6d07f43..bffa19a8c 100644
--- a/test/box/ddl.result
+++ b/test/box/ddl.result
@@ -350,7 +350,7 @@ box.space._collation:auto_increment{'test', 0, 
'ICU', 42}
  ...
  box.space._collation:auto_increment{'test', 0, 'ICU', 'ru_RU', 
setmap{}} --ok
  ---
-- [4, 'test', 0, 'ICU', 'ru_RU', {}]
+- [5, 'test', 0, 'ICU', 'ru_RU', {}]
  ...
  box.space._collation:auto_increment{'test', 0, 'ICU', 'ru_RU', setmap{}}
  ---
@@ -358,7 +358,7 @@ box.space._collation:auto_increment{'test', 0, 
'ICU', 'ru_RU', setmap{}}
  ...
  box.space._collation.index.name:delete{'test'} -- ok
  ---
-- [4, 'test', 0, 'ICU', 'ru_RU', {}]
+- [5, 'test', 0, 'ICU', 'ru_RU', {}]
  ...
  box.space._collation.index.name:delete{'nothing'} -- allowed
  ---
@@ -474,7 +474,7 @@ _ = box.space._collation.index.name:delete{'test'} -- ok
  ...
  box.space._collation:auto_increment{'test', 0, 'ICU', 'ru_RU', setmap{}}
  ---
-- [4, 'test', 0, 'ICU', 'ru_RU', {}]
+- [5, 'test', 0, 'ICU', 'ru_RU', {}]
  ...
  box.space._collation:select{}
  ---
@@ -482,7 +482,8 @@ box.space._collation:select{}
    - [1, 'unicode', 1, 'ICU', '', {}]
    - [2, 'unicode_ci', 1, 'ICU', '', {'strength': 'primary'}]
    - [3, 'binary', 1, 'BINARY', '', {}]
-  - [4, 'test', 0, 'ICU', 'ru_RU', {}]
+  - [4, 'unicode_ru_s2', 1, 'ICU', 'ru_RU', {'strength': 'secondary'}]
+  - [5, 'test', 0, 'ICU', 'ru_RU', {}]
  ...
  test_run:cmd('restart server default')
  box.space._collation:select{}
@@ -491,11 +492,12 @@ box.space._collation:select{}
    - [1, 'unicode', 1, 'ICU', '', {}]
    - [2, 'unicode_ci', 1, 'ICU', '', {'strength': 'primary'}]
    - [3, 'binary', 1, 'BINARY', '', {}]
-  - [4, 'test', 0, 'ICU', 'ru_RU', {}]
+  - [4, 'unicode_ru_s2', 1, 'ICU', 'ru_RU', {'strength': 'secondary'}]
+  - [5, 'test', 0, 'ICU', 'ru_RU', {}]
  ...
  box.space._collation.index.name:delete{'test'}
  ---
-- [4, 'test', 0, 'ICU', 'ru_RU', {}]
+- [5, 'test', 0, 'ICU', 'ru_RU', {}]
  ...
  --
  -- gh-3290: expose ICU into Lua. It uses built-in collations, that
diff --git a/test/box/net.box.result b/test/box/net.box.result
index b800531b4..67bb29a39 100644
--- a/test/box/net.box.result
+++ b/test/box/net.box.result
@@ -2666,7 +2666,7 @@ c.space.test.index.sk.parts
  ---
  - - type: string
      is_nullable: false
-    collation_id: 4
+    collation_id: 5
      fieldno: 1
  ...
  c:close()
diff --git a/test/sql-tap/collation.test.lua 
b/test/sql-tap/collation.test.lua
index 1e55b0092..cec980423 100755
--- a/test/sql-tap/collation.test.lua
+++ b/test/sql-tap/collation.test.lua
@@ -21,9 +21,10 @@ test:do_execsql_test(
          1,"unicode",
          2,"unicode_ci",
          3,"binary",
-        4,"unicode_numeric",
-        5,"unicode_numeric_s2",
-        6,"unicode_tur_s2"
+        4,"unicode_ru_s2",
+        5,"unicode_numeric",
+        6,"unicode_numeric_s2",
+        7,"unicode_tur_s2"
      }
  )

diff --git a/test/sql/collation.result b/test/sql/collation.result
index daea35543..8337dde0e 100644
--- a/test/sql/collation.result
+++ b/test/sql/collation.result
@@ -427,3 +427,114 @@ box.space.T4A:drop()
  box.space.T4B:drop()
  ---
  ...
+--
+-- gh-4007 Feature request for a new collation
+--
+-- Default unicode collation deals with russian letters
+s = box.schema.space.create('t1')
+---
+...
+s:format({{name='s1', type='string', collation = 'unicode'}})
+---
+...
+idx = s:create_index('pk', {unique = true, type='tree', parts={{'s1', 
collation = 'unicode'}}})
+---
+...
+s:insert{'Ё'}
+---
+- ['Ё']
+...
+s:insert{'Е'}
+---
+- ['Е']
+...
+s:insert{'ё'}
+---
+- ['ё']
+...
+s:insert{'е'}
+---
+- ['е']
+...
+-- all 4 letters are in the table
+s:select{}
+---
+- - ['е']
+  - ['Е']
+  - ['ё']
+  - ['Ё']
+...
+s:drop()
+---
+...
+-- unicode_ci collation doesn't distinguish russian letters 'Е' and 'Ё'
+s = box.schema.space.create('t1')
+---
+...
+s:format({{name='s1', type='string', collation = 'unicode_ci'}})
+---
+...
+idx = s:create_index('pk', {unique = true, type='tree', parts={{'s1', 
collation = 'unicode_ci'}}})
+---
+...
+s:insert{'Ё'}
+---
+- ['Ё']
+...
+-- the following calls should fail
+s:insert{'е'}
+---
+- error: Duplicate key exists in unique index 'pk' in space 't1'
+...
+s:insert{'Е'}
+---
+- error: Duplicate key exists in unique index 'pk' in space 't1'
+...
+s:insert{'ё'}
+---
+- error: Duplicate key exists in unique index 'pk' in space 't1'
+...
+-- return single 'Ё'
+s:select{}
+---
+- - ['Ё']
+...
+s:drop()
+---
+...
+-- unicode_s2 collation does distinguish russian letters 'Е' and 'Ё'
+s = box.schema.space.create('t1')
+---
+...
+s:format({{name='s1', type='string', collation = 'unicode_ru_s2'}})
+---
+...
+idx = s:create_index('pk', {unique = true, type='tree', parts={{'s1', 
collation = 'unicode_ru_s2'}}})
+---
+...
+s:insert{'Ё'}
+---
+- ['Ё']
+...
+s:insert{'е'}
+---
+- ['е']
+...
+-- the following calls should fail
+s:insert{'Е'}
+---
+- error: Duplicate key exists in unique index 'pk' in space 't1'
+...
+s:insert{'ё'}
+---
+- error: Duplicate key exists in unique index 'pk' in space 't1'
+...
+-- return two: 'Ё' and 'е'
+s:select{}
+---
+- - ['е']
+  - ['Ё']
+...
+s:drop()
+---
+...
diff --git a/test/sql/collation.test.lua b/test/sql/collation.test.lua
index 713a9bd89..6f4ef08f3 100644
--- a/test/sql/collation.test.lua
+++ b/test/sql/collation.test.lua
@@ -172,3 +172,44 @@ box.sql.execute("SELECT a FROM t4b ORDER BY a || b")

  box.space.T4A:drop()
  box.space.T4B:drop()
+
+--
+-- gh-4007 Feature request for a new collation
+--
+-- Default unicode collation deals with russian letters
+s = box.schema.space.create('t1')
+s:format({{name='s1', type='string', collation = 'unicode'}})
+idx = s:create_index('pk', {unique = true, type='tree', parts={{'s1', 
collation = 'unicode'}}})
+s:insert{'Ё'}
+s:insert{'Е'}
+s:insert{'ё'}
+s:insert{'е'}
+-- all 4 letters are in the table
+s:select{}
+s:drop()
+
+-- unicode_ci collation doesn't distinguish russian letters 'Е' and 'Ё'
+s = box.schema.space.create('t1')
+s:format({{name='s1', type='string', collation = 'unicode_ci'}})
+idx = s:create_index('pk', {unique = true, type='tree', parts={{'s1', 
collation = 'unicode_ci'}}})
+s:insert{'Ё'}
+-- the following calls should fail
+s:insert{'е'}
+s:insert{'Е'}
+s:insert{'ё'}
+-- return single 'Ё'
+s:select{}
+s:drop()
+
+-- unicode_s2 collation does distinguish russian letters 'Е' and 'Ё'
+s = box.schema.space.create('t1')
+s:format({{name='s1', type='string', collation = 'unicode_ru_s2'}})
+idx = s:create_index('pk', {unique = true, type='tree', parts={{'s1', 
collation = 'unicode_ru_s2'}}})
+s:insert{'Ё'}
+s:insert{'е'}
+-- the following calls should fail
+s:insert{'Е'}
+s:insert{'ё'}
+-- return two: 'Ё' and 'е'
+s:select{}
+s:drop()
-- 
2.17.1

  reply	other threads:[~2019-02-28 12:14 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-02-26 10:40 Stanislav Zudin
2019-02-26 13:52 ` Vladimir Davydov
2019-02-28 12:14   ` Stanislav Zudin [this message]
2019-02-28 15:46     ` [tarantool-patches] " Vladimir Davydov

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=230d10ab-6b3c-f5c0-853c-d48624a8cf4f@tarantool.org \
    --to=szudin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] Re: [PATCH v2] Feature request for a new collation' \
    /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