Tarantool development patches archive
 help / color / mirror / Atom feed
From: Konstantin Osipov <kostja@tarantool.org>
To: tarantool-patches@freelists.org
Cc: vdavydov.dev@gmail.com, Kirill Shcherbatov <kshcherbatov@tarantool.org>
Subject: Re: [tarantool-patches] [PATCH v3 4/4] box: introduce functional indexes in memtx
Date: Thu, 18 Jul 2019 12:50:29 +0300	[thread overview]
Message-ID: <20190718095029.GD21191@atlas> (raw)
In-Reply-To: <d795cfdddfa27dd7f7fe45d684ec84be8f7f87df.1563326037.git.kshcherbatov@tarantool.org>

* Kirill Shcherbatov <kshcherbatov@tarantool.org> [19/07/17 09:39]:
> Closes #1260
> 
> @TarantoolBot document
> Title: introduce functional indexes in memtx
> Now you can define a functional index using registered persistent
> function as key extractor.
> 
> There is some restrictions for function and key definition for
> functional index:
>  - referenced extractor function must be persistent, deterministic
>    and return scalar type or array.
>  - key parts describe the referenced routine's returned key
>    (when the routine returned value type is array in meaning of
>    multikey index key): all parts must be sequential and the
>    first part's fieldno must be 1.
>  - key parts can't use JSON paths.
>  - you are not allowed to access tuple fields by names in functional
>    index extractor
> 
> Functional index can't be primary.
> You are not allowed to change functional index extractor function
> while there are some functional indexes depends of it.
> 
> Example:
> s = box.schema.space.create('withdata')
> s:format({{name = 'name', type = 'string'},
>           {name = 'address', type = 'string'}})
> pk = s:create_index('name', {parts = {1, 'string'}})
> lua_code = [[function(tuple)
>                 local address = string.split(tuple[2])
>                 local ret = {}
>                 for _, v in pairs(address) do
> 			table.insert(ret, {utf8.upper(v)})
> 		end
>                 return unpack(ret)
>              end]]
> box.schema.func.create('addr_extractor', {body = lua_code,
>                        is_deterministic = true, is_sandboxed = true})
> idx = s:create_index('addr', {unique = false, functional_fid =
>                      box.func.addr_extractor.id, is_multikey = true,
>                      parts = {{1, 'string'}}})
> s:insert({"James", "SIS Building Lambeth London UK"})
> s:insert({"Sherlock", "221B Baker St Marylebone London NW1 6XE UK"})
> idx:select('UK')
> ---
> - - ['James', 'SIS Building Lambeth London UK']
>   - ['Sherlock', '221B Baker St Marylebone London NW1 6XE UK']

this is a huge patch with only 3 tiny prerequisites.

Are you sure it's not possible to split it into pieces?


-- 
Konstantin Osipov, Moscow, Russia

  reply	other threads:[~2019-07-18  9:50 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-17  1:20 [PATCH v3 0/4] box: functional indexes Kirill Shcherbatov
2019-07-17  1:20 ` [PATCH v3 1/4] box: introduce key_def->is_multikey flag Kirill Shcherbatov
2019-07-17 14:34   ` Konstantin Osipov
2019-07-18 11:20   ` [tarantool-patches] " Kirill Yukhin
2019-07-17  1:20 ` [PATCH v3 2/4] box: refactor key_validate_parts to return key_end Kirill Shcherbatov
2019-07-18  9:41   ` Konstantin Osipov
2019-07-18 11:21   ` [tarantool-patches] " Kirill Yukhin
2019-07-17  1:20 ` [PATCH v3 3/4] box: introduce tuple_extra infrastructure Kirill Shcherbatov
2019-07-18  9:47   ` Konstantin Osipov
2019-07-17  1:20 ` [PATCH v3 4/4] box: introduce functional indexes in memtx Kirill Shcherbatov
2019-07-18  9:50   ` Konstantin Osipov [this message]
2019-07-18  9:54   ` [tarantool-patches] " Konstantin Osipov
2019-07-18  9:55   ` Konstantin Osipov
2019-07-18 10:02   ` Konstantin Osipov
2019-07-22 14:45   ` 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=20190718095029.GD21191@atlas \
    --to=kostja@tarantool.org \
    --cc=kshcherbatov@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [tarantool-patches] [PATCH v3 4/4] box: introduce functional indexes in memtx' \
    /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