From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Date: Fri, 22 Mar 2019 19:20:47 +0300 From: Alexander Turenko Subject: Re: [tarantool-patches] [PATCH 0/3] lua: add key_def lua module Message-ID: <20190322162047.mg5y2aeezp5jfebj@tkn_work_nb> References: <50d5c1d8-077a-e564-d28c-7e71ab79deff@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <50d5c1d8-077a-e564-d28c-7e71ab79deff@tarantool.org> To: Kirill Shcherbatov Cc: tarantool-patches@freelists.org, Vladimir Davydov List-ID: Thank you for the review! Answers are below. WBR, Alexander Turenko. On Fri, Mar 22, 2019 at 05:24:33PM +0300, Kirill Shcherbatov wrote: > Hi! Can't find the patch that we were discussed, so, I've copied It from branch by my own. > > The code you implemented is very similar in many ways to the one already implemented in key_def.c. > I have one principal proposal and one advice(may be good enough): > 1) at first, all map key names must follow their semantic-twin is used with create_index/alter; > I mean field, not fieldno e.g. > The errors also must not differ, I believe. > https://tarantool.io/en/doc/1.10/book/box/box_space/#box-space-create-index Sadly, create_index/alter format differs from one that is used in box.space.<...>.index.<...>.parts. I think we definitely should support the latter one, because typical use case of the key_def module is when you already have an index and want to use its parts to create a Lua key_def instance. > > 2) (proposal) I think you can do without the function load_key_def_set_part, that repeats] > key_def_decode_parts code in many moments. You may encode tuple on region with > lbox_encode_tuple_on_gc() and pass it to key_def_decode_parts(). While key_def:new is > not performance-critical, this is better managed way to solve this problem, I think. Consider my > RFC diff below: > It would be good to do it in that way (it recuces code duplication), but I have two possible problems in the mind: * The formats are different: field vs fieldno. * Support net.box's collation_id (instead of collation). Maybe this problem will gone after fixing #3941.