From: Vladimir Davydov <vdavydov.dev@gmail.com>
To: Kirill Shcherbatov <kshcherbatov@tarantool.org>
Cc: tarantool-patches@freelists.org
Subject: Re: [PATCH v5 2/4] memtx: introduce tuple compare hint
Date: Mon, 11 Mar 2019 13:39:58 +0300 [thread overview]
Message-ID: <20190311103958.2zh6cdzbqnpzjrfa@esperanza> (raw)
In-Reply-To: <53e165cf566611452821c692d79d621628e839ff.1551951540.git.kshcherbatov@tarantool.org>
On Thu, Mar 07, 2019 at 12:44:06PM +0300, Kirill Shcherbatov wrote:
> +void
> +key_def_set_cmp_aux_func(struct key_def *def)
> +{
> + def->key_cmp_aux = key_hint_default;
> + def->tuple_cmp_aux = tuple_hint_default;
> + bool is_nullable = key_part_is_nullable(def->parts);
> + if (def->parts->type == FIELD_TYPE_STRING && def->parts->coll != NULL) {
> + def->key_cmp_aux = is_nullable ? key_hint_string_coll<true> :
> + key_hint_string_coll<false>;
> + def->tuple_cmp_aux = is_nullable ?
> + tuple_hint_string_coll<true> :
> + tuple_hint_string_coll<false>;
> + return;
> + }
> + switch (def->parts->type) {
> + case FIELD_TYPE_UNSIGNED:
> + def->key_cmp_aux = is_nullable ? key_hint_uint<true> :
> + key_hint_uint<false>;
> + def->tuple_cmp_aux = is_nullable ? tuple_hint_uint<true> :
> + tuple_hint_uint<false>;
> + break;
> + case FIELD_TYPE_INTEGER:
> + def->key_cmp_aux = is_nullable ? key_hint_int<true> :
> + key_hint_int<false>;
> + def->tuple_cmp_aux = is_nullable ? tuple_hint_int<true> :
> + tuple_hint_int<false>;
> + break;
> + case FIELD_TYPE_STRING:
> + def->key_cmp_aux = is_nullable ? key_hint_string<true> :
> + key_hint_string<false>;
> + def->tuple_cmp_aux = is_nullable ? tuple_hint_string<true> :
> + tuple_hint_string<false>;
> + break;
> + case FIELD_TYPE_NUMBER:
> + def->key_cmp_aux = is_nullable ? key_hint_number<true> :
> + key_hint_number<false>;
> + def->tuple_cmp_aux = is_nullable ? tuple_hint_number<true> :
> + tuple_hint_number<false>;
> + break;
> + case FIELD_TYPE_BOOLEAN:
> + def->key_cmp_aux = is_nullable ? key_hint_boolean<true> :
> + key_hint_boolean<false>;
> + def->tuple_cmp_aux = is_nullable ? tuple_hint_boolean<true> :
> + tuple_hint_boolean<false>;
> + break;
> + default:
> + break;
> + };
> }
I haven't looked into this patch in details yet (expect a separate
email), but at the first glance it looks there's a serious problem we
must address before moving forward - you don't take into account SCALAR
type. The tricky part is SCALAR can be converted to any other basic type
(e.g. INTEGER) without rebuilding the index. So we should either
introduce hints for SCALAR types as well and make them compatible with
basic types or disable hints for SCALAR altogether. Anyway, we need a
test for this.
next prev parent reply other threads:[~2019-03-11 10:39 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-03-07 9:44 [PATCH v5 0/4] box: introduce hint option for memtx tree index Kirill Shcherbatov
2019-03-07 9:44 ` [PATCH v5 1/4] memtx: rework memtx_tree to store arbitrary nodes Kirill Shcherbatov
2019-03-11 10:34 ` Vladimir Davydov
2019-03-11 16:53 ` [tarantool-patches] " Kirill Shcherbatov
2019-03-12 10:45 ` Vladimir Davydov
2019-03-07 9:44 ` [PATCH v5 2/4] memtx: introduce tuple compare hint Kirill Shcherbatov
2019-03-07 10:42 ` [tarantool-patches] " Konstantin Osipov
2019-03-07 10:59 ` Vladimir Davydov
2019-03-11 10:39 ` Vladimir Davydov [this message]
2019-03-11 17:03 ` Vladimir Davydov
2019-03-12 13:00 ` Vladimir Davydov
2019-03-07 9:44 ` [PATCH v5 3/4] box: move offset_slot init to tuple_format_add_field Kirill Shcherbatov
2019-03-07 15:53 ` [tarantool-patches] " Kirill Shcherbatov
2019-03-07 9:44 ` [PATCH v5 4/4] box: introduce multikey indexes Kirill Shcherbatov
2019-03-07 15:55 ` [tarantool-patches] " Kirill Shcherbatov
2019-03-12 13:24 ` Vladimir Davydov
2019-03-07 10:45 ` [tarantool-patches] [PATCH v5 0/4] box: introduce hint option for memtx tree index Konstantin Osipov
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=20190311103958.2zh6cdzbqnpzjrfa@esperanza \
--to=vdavydov.dev@gmail.com \
--cc=kshcherbatov@tarantool.org \
--cc=tarantool-patches@freelists.org \
--subject='Re: [PATCH v5 2/4] memtx: introduce tuple compare hint' \
/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