From: Oleg Babin via Tarantool-patches <tarantool-patches@dev.tarantool.org> To: Timur Safin <tsafin@tarantool.org>, v.shpilevoy@tarantool.org Cc: tarantool-patches@dev.tarantool.org Subject: Re: [Tarantool-patches] [PATCH resend v2 06/11] box, datetime: datetime comparison for indices Date: Thu, 29 Jul 2021 21:56:46 +0300 [thread overview] Message-ID: <1f485144-efa1-3b19-c283-380908f4975c@tarantool.org> (raw) In-Reply-To: <2939f293071df83ba612c431895adea49c9cb8de.1627468002.git.tsafin@tarantool.org> Thanks for your patch. One question below. Also update with arithmetic operations doesn't work. ``` tarantool> box.space.dt:update({v}, {{'+', 2, 3}}) --- - error: 'Argument type in operation ''+'' on field 2 does not match field type: expected a number' ... tarantool> box.space.dt:update({v}, {{'+', 2, dt.week(1)}}) --- - error: unsupported Lua type 'cdata' ... ``` On 28.07.2021 13:34, Timur Safin via Tarantool-patches wrote: > * storage hints implemented for datetime_t values; > * proper comparison for indices of datetime type. > > > diff --git a/test/engine/datetime.result b/test/engine/datetime.result > new file mode 100644 > index 000000000..3ff474dee > --- /dev/null > +++ b/test/engine/datetime.result > @@ -0,0 +1,77 @@ > +-- test-run result file version 2 > +env = require('test_run') > + | --- > + | ... > +test_run = env.new() > + | --- > + | ... > +engine = test_run:get_cfg('engine') > + | --- > + | ... > + > +date = require('datetime') > + | --- > + | ... > + > +_ = box.schema.space.create('T', {engine = engine}) > + | --- > + | ... > +_ = box.space.T:create_index('pk', {parts={1,'datetime'}}) > + | --- > + | ... > + > +box.space.T:insert{date('1970-01-01')}\ > +box.space.T:insert{date('1970-01-02')}\ > +box.space.T:insert{date('1970-01-03')}\ > +box.space.T:insert{date('2000-01-01')} > + | --- > + | ... > + > +o = box.space.T:select{} > + | --- > + | ... > +assert(tostring(o[1][1]) == '1970-01-01T00:00Z') > + | --- > + | - true > + | ... > +assert(tostring(o[2][1]) == '1970-01-02T00:00Z') > + | --- > + | - true > + | ... > +assert(tostring(o[3][1]) == '1970-01-03T00:00Z') > + | --- > + | - true > + | ... > +assert(tostring(o[4][1]) == '2000-01-01T00:00Z') > + | --- > + | - true > + | ... > + > +for i = 1,16 do\ > + box.space.T:insert{date.now()}\ > +end > + | --- > + | ... > + > +a = box.space.T:select{} > + | --- > + | ... > +err = nil > + | --- > + | ... > +for i = 1, #a - 1 do\ > + if tostring(a[i][1]) >= tostring(a[i+1][1]) then\ Why do you compare string representation but not values itself? > + err = {a[i][1], a[i+1][1]}\ > + break\ > + end\ > +end > + | --- > + | ... > + > +err > + | --- > + | - null > + | ... > +box.space.T:drop() > + | --- > + | ... >
next prev parent reply other threads:[~2021-07-29 18:57 UTC|newest] Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top 2021-07-28 10:34 [Tarantool-patches] [PATCH resend v2 00/11] Initial datetime support Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 01/11] build: add Christian Hansen c-dt to the build Timur Safin via Tarantool-patches 2021-07-29 23:40 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-31 9:22 ` Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 02/11] lua: built-in module datetime Timur Safin via Tarantool-patches 2021-07-29 18:55 ` Oleg Babin via Tarantool-patches 2021-07-30 19:00 ` Timur Safin via Tarantool-patches 2021-07-31 6:29 ` Oleg Babin via Tarantool-patches 2021-07-31 16:51 ` Timur Safin via Tarantool-patches 2021-07-29 23:36 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-30 15:39 ` Timur Safin via Tarantool-patches 2021-08-01 17:01 ` Vladislav Shpilevoy via Tarantool-patches 2021-08-01 20:23 ` Timur Safin via Tarantool-patches 2021-08-04 23:57 ` Vladislav Shpilevoy via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 03/11] lua, datetime: datetime tests Timur Safin via Tarantool-patches 2021-07-29 18:55 ` Oleg Babin via Tarantool-patches 2021-07-30 20:45 ` Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 04/11] lua, datetime: display datetime Timur Safin via Tarantool-patches 2021-07-29 18:55 ` Oleg Babin via Tarantool-patches 2021-07-30 21:48 ` Timur Safin via Tarantool-patches 2021-07-31 6:29 ` Oleg Babin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 05/11] box, datetime: add messagepack support for datetime Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 06/11] box, datetime: datetime comparison for indices Timur Safin via Tarantool-patches 2021-07-29 18:56 ` Oleg Babin via Tarantool-patches [this message] 2021-07-30 22:18 ` Timur Safin via Tarantool-patches 2021-07-31 6:30 ` Oleg Babin via Tarantool-patches 2021-07-31 9:31 ` Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 07/11] lua, datetime: proper datetime encoding Timur Safin via Tarantool-patches 2021-07-29 18:57 ` Oleg Babin via Tarantool-patches 2021-07-30 22:20 ` Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 08/11] lua, datetime: calculated attributes for datetimes Timur Safin via Tarantool-patches 2021-07-29 18:57 ` Oleg Babin via Tarantool-patches 2021-07-30 22:30 ` Timur Safin via Tarantool-patches 2021-07-31 6:31 ` Oleg Babin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 09/11] lua, datetime: time intervals support Timur Safin via Tarantool-patches 2021-07-29 18:58 ` Oleg Babin via Tarantool-patches 2021-07-30 22:58 ` Timur Safin via Tarantool-patches 2021-07-31 6:31 ` Oleg Babin via Tarantool-patches 2021-07-31 9:20 ` Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 10/11] lua, datetime: unixtime, timestamp setters in datetime.lua Timur Safin via Tarantool-patches 2021-07-29 18:58 ` Oleg Babin via Tarantool-patches 2021-07-30 23:11 ` Timur Safin via Tarantool-patches 2021-07-31 6:31 ` Oleg Babin via Tarantool-patches 2021-07-31 9:54 ` Timur Safin via Tarantool-patches 2021-07-28 10:34 ` [Tarantool-patches] [PATCH resend v2 11/11] datetime: changelog for datetime module Timur Safin via Tarantool-patches 2021-07-29 18:55 ` [Tarantool-patches] [PATCH resend v2 00/11] Initial datetime support Oleg Babin 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=1f485144-efa1-3b19-c283-380908f4975c@tarantool.org \ --to=tarantool-patches@dev.tarantool.org \ --cc=olegrok@tarantool.org \ --cc=tsafin@tarantool.org \ --cc=v.shpilevoy@tarantool.org \ --subject='Re: [Tarantool-patches] [PATCH resend v2 06/11] 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