From: Timur Safin via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: "'Serge Petrenko'" <sergepetrenko@tarantool.org>, <v.shpilevoy@tarantool.org>, <olegrok@tarantool.org> Cc: <tarantool-patches@dev.tarantool.org> Subject: Re: [Tarantool-patches] [PATCH v3 6/9] box, datetime: datetime comparison for indices Date: Wed, 4 Aug 2021 13:12:52 +0300 [thread overview] Message-ID: <013901d78919$49a2c230$dce84690$@tarantool.org> (raw) In-Reply-To: Hello Sergey, Here is small update since previous message... > > You just need to assign the same HINT_VALUE_MAX hint to every > datetime value > > with date->secs >= HINT_VALUE_SECS_MAX. Otherwise the comparison > would > > make mistakes (judging by hint values only) for such far away > dates. > > Yes, thanks for the note, will make sure that values which exceed > selected > 36-bit will stick to the maximum value. Introduced this simple fix to the current code: ---------------------------------------- diff --git a/src/box/tuple_compare.cc b/src/box/tuple_compare.cc index f733b9f01..0c5e0b666 100644 --- a/src/box/tuple_compare.cc +++ b/src/box/tuple_compare.cc @@ -1659,7 +1659,8 @@ hint_datetime(struct datetime_t *date) int32_t nsec = date->nsec; uint64_t val = secs <= HINT_VALUE_SECS_MIN ? 0 : secs - HINT_VALUE_SECS_MIN; - val &= HINT_VALUE_SECS_MAX; + if (val >= HINT_VALUE_SECS_MAX) + val = HINT_VALUE_SECS_MAX; val <<= HINT_VALUE_NSEC_BITS; val |= (nsec >> HINT_VALUE_NSEC_SHIFT) & HINT_VALUE_NSEC_MAX; return hint_create(MP_CLASS_DATETIME, val); ---------------------------------------- Updated accordingly and force-pushed to the branch. > > But you don't allow datetime in SCALAR fields, as I see in the > previous > > commit. > > So you don't need to account for datetime in scalar hints. > > That's bug - every type is scalar type, unless it's collection (map > or array) > so datetime should be considered as scalar. That was oversight if > not. > Thanks! Also DATETIME is considered compatible with SCALAR type in MessagePack and with scalar column. Also updated patch, and force-pushed to branch. Thanks, Timur
next prev parent reply other threads:[~2021-08-04 10:12 UTC|newest] Thread overview: 38+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-08-02 0:40 [Tarantool-patches] [PATCH v3 0/9] Initial datetime support Timur Safin via Tarantool-patches 2021-08-02 0:40 ` [Tarantool-patches] [PATCH v3 1/9] build: add Christian Hansen c-dt to the build Timur Safin via Tarantool-patches 2021-08-04 23:58 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-05 8:55 ` Safin Timur via Tarantool-patches 2021-08-08 14:34 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-02 0:40 ` [Tarantool-patches] [PATCH v3 2/9] lua: built-in module datetime Timur Safin via Tarantool-patches 2021-08-04 23:58 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-06 0:23 ` Safin Timur via Tarantool-patches 2021-08-06 1:30 ` Oleg Babin via Tarantool-patches 2021-08-06 13:00 ` Safin Timur via Tarantool-patches 2021-08-06 17:24 ` Safin Timur via Tarantool-patches 2021-08-08 11:26 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-08 16:35 ` Safin Timur via Tarantool-patches 2021-08-10 12:20 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-10 12:21 ` Igor Munkin via Tarantool-patches 2021-08-12 20:47 ` Safin Timur via Tarantool-patches 2021-08-15 20:52 ` Safin Timur via Tarantool-patches 2021-08-06 0:26 ` Safin Timur via Tarantool-patches 2021-08-08 14:34 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-08 16:47 ` Safin Timur via Tarantool-patches 2021-08-02 0:40 ` [Tarantool-patches] [PATCH v3 3/9] lua, datetime: datetime tests Timur Safin via Tarantool-patches 2021-08-06 0:25 ` Safin Timur via Tarantool-patches 2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 4/9] lua, datetime: display datetime Timur Safin via Tarantool-patches 2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 5/9] box, datetime: messagepack support for datetime Timur Safin via Tarantool-patches 2021-08-03 13:38 ` Timur Safin via Tarantool-patches 2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 6/9] box, datetime: datetime comparison for indices Timur Safin via Tarantool-patches 2021-08-03 12:02 ` Serge Petrenko via Tarantool-patches 2021-08-03 12:59 ` Timur Safin via Tarantool-patches 2021-08-04 10:12 ` Timur Safin via Tarantool-patches [this message] 2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 7/9] lua, datetime: time intervals support Timur Safin via Tarantool-patches 2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 8/9] datetime: changelog for datetime module Timur Safin via Tarantool-patches 2021-08-02 0:41 ` [Tarantool-patches] [PATCH v3 9/9] lua, box, datetime: rename struct datetime_t Timur Safin via Tarantool-patches 2021-08-06 0:27 ` Safin Timur via Tarantool-patches 2021-08-03 21:23 ` [Tarantool-patches] [PATCH v3 1/2] datetime: update tests for macosx Timur Safin via Tarantool-patches 2021-08-06 0:28 ` Safin Timur via Tarantool-patches 2021-08-03 21:23 ` [Tarantool-patches] [PATCH v3 2/2] lua, datetime: introduce ctime, strftime wrappers Timur Safin via Tarantool-patches 2021-08-06 0:30 ` Safin Timur via Tarantool-patches 2021-08-03 21:26 ` [Tarantool-patches] [PATCH v3 0/9] Initial datetime support Timur Safin via Tarantool-patches
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='013901d78919$49a2c230$dce84690$@tarantool.org' \ --to=tarantool-patches@dev.tarantool.org \ --cc=olegrok@tarantool.org \ --cc=sergepetrenko@tarantool.org \ --cc=tsafin@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH v3 6/9] box, datetime: datetime comparison for indices' \ /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