Tarantool development patches archive
 help / color / mirror / Atom feed
From: Kirill Yukhin <kyukhin@tarantool.org>
To: Vladimir Davydov <vdavydov.dev@gmail.com>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH] sql: do not store key_def in VDBE op
Date: Tue, 25 Sep 2018 13:11:04 +0300	[thread overview]
Message-ID: <20180925101104.scokyq4wwluive4x@tarantool.org> (raw)
In-Reply-To: <d022bb225bc70bb9dc4e17e04bec05e679096daa.1537810971.git.vdavydov.dev@gmail.com>

Hello,
On 24 сен 20:49, Vladimir Davydov wrote:
> The parser must not deal with internal Tarantool objects, such as space,
> index, or key_def, directly, because it (a) violates encapsulation,
> turning the code into a convoluted mess, and (b) makes it impossible to
> run the parser and VDBE on different instances, which might come in
> handy for cluster SQL implementation. Instead, it should store plain
> names in the generated VDBE code. It may use objects the sole purpose
> of which is to represent object definitions, such as key_part_def or
> field_def, though.
> 
> This patch does a tiny step in this direction. It replaces key_def with
> sql_key_info in VDBE arguments. The new structure is a trivial wrapper
> around an array of key_part_def. It is ref-countable, just like its
> predecessor KeyInfo, so as to avoid unnecessary memory duplication.
> Since key_def spread roots deeply into the parser implementation, the
> new structure has two extra methods:
> 
>   sql_key_info_new_from_key_def
>   sql_key_info_to_key_def
> 
> so that it can be converted to/from a key definition. Note, the latter
> caches the result so as not to create a new key definition on subsequent
> function calls.
> 
> This partially undoes the work done by commit 501c6e28b095 ("sql:
> replace KeyInfo with key_def").
> 
> The reason why I'm doing this now is that I want to dispose of the
> key_def_set_part function, which is used extensively by the parser,
> because the latter stores key_def directly in VDBE op. This function
> has a vague semantic and rather obscures construction of a key
> definition. It will get especially nasty once JSON path indexes are
> introduced in Tarantool core. The new struct, sql_key_info, allows us
> to get rid of most of those calls.
> ---
> https://github.com/tarantool/tarantool/tree/merge-2.0
Your patch is OK for 2.0 branch.

--
Regards, Kirill Yukhin

      reply	other threads:[~2018-09-25 10:11 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-09-24 17:49 Vladimir Davydov
2018-09-25 10:11 ` Kirill Yukhin [this message]

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=20180925101104.scokyq4wwluive4x@tarantool.org \
    --to=kyukhin@tarantool.org \
    --cc=tarantool-patches@freelists.org \
    --cc=vdavydov.dev@gmail.com \
    --subject='Re: [PATCH] sql: do not store key_def in VDBE op' \
    /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