From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from [87.239.111.99] (localhost [127.0.0.1]) by dev.tarantool.org (Postfix) with ESMTP id 9DE196EC55; Sat, 31 Jul 2021 01:18:48 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 9DE196EC55 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1627683528; bh=AHBxNgcGdKYI0ITWEYYhBKvId7Jy1VCc4Ln+3R5KXOM=; h=To:Cc:References:In-Reply-To:Date:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=k4su9ryJelMRaMw2bXuSLXRAHr+r5iYASZTUKne0ZdRNXAjxl3UatgAGmeAwa9QFK UdH7wvUR3wg3m6zNjc4v8OG7/26AjhgcFngGNl1l5m5fUqKaqkSRHjVxXh1EQFIGb6 pZwDJfS2yUTniEHY0+dw7BTLxus9B6+kQEVMupGg= Received: from smtp47.i.mail.ru (smtp47.i.mail.ru [94.100.177.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dev.tarantool.org (Postfix) with ESMTPS id 6A7EF6EC55 for ; Sat, 31 Jul 2021 01:18:47 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 6A7EF6EC55 Received: by smtp47.i.mail.ru with esmtpa (envelope-from ) id 1m9aq6-0002eV-Jv; Sat, 31 Jul 2021 01:18:47 +0300 To: "'Oleg Babin'" , Cc: References: <2939f293071df83ba612c431895adea49c9cb8de.1627468002.git.tsafin@tarantool.org> <1f485144-efa1-3b19-c283-380908f4975c@tarantool.org> In-Reply-To: <1f485144-efa1-3b19-c283-380908f4975c@tarantool.org> Date: Sat, 31 Jul 2021 01:18:45 +0300 Message-ID: <044f01d78590$dd7053b0$9850fb10$@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Mailer: Microsoft Outlook 16.0 Thread-Index: AQNJI0ot4YBfKbZyj2tYNprdOv6c+gIIcmeUAav/7B2oWjc18A== Content-Language: ru X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD941C43E597735A9C351B198F4576AC7B21928AAE70459C21B182A05F5380850401FD0122B56B5C43351B26F79AEA8B19A7412492251F3F91090F0988343784BA5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE74B51810D54EC17F0C2099A533E45F2D0395957E7521B51C2CFCAF695D4D8E9FCEA1F7E6F0F101C6778DA827A17800CE7FDE19FEC90BA7BD78F08D7030A58E5AD1A62830130A00468AEEEE3FBA3A834EE7353EFBB5533756682A4B7DEF78398815DDC0787DE3C0DBDED7BE808702E25ACA471835C12D1D9774AD6D5ED66289B5278DA827A17800CE71AE4D56B06699BBC9FA2833FD35BB23D2EF20D2F80756B5F868A13BD56FB6657A471835C12D1D977725E5C173C3A84C317B107DEF921CE79117882F4460429728AD0CFFFB425014E868A13BD56FB6657D81D268191BDAD3DC09775C1D3CA48CFB9E0336EE4E43422BA3038C0950A5D36C8A9BA7A39EFB766EC990983EF5C0329BA3038C0950A5D36D5E8D9A59859A8B6703B1FC9D34BD8A876E601842F6C81A1F004C906525384307823802FF610243DF43C7A68FF6260569E8FC8737B5C2249EC8D19AE6D49635B68655334FD4449CB9ECD01F8117BC8BEAAAE862A0553A39223F8577A6DFFEA7C468D16C903838CAB43847C11F186F3C59DAA53EE0834AAEE X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458F0AFF96BAACF4158235E5A14AD4A4A4625E192CAD1D9E79DB53CE8437368708954FBCB63B27C8CDF X-C1DE0DAB: 0D63561A33F958A52603BDA8154E51A6B4BFE28A7C37969C70DF5DCE5103F200D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA751B940EDA0DFB0535410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D348CDF4129B2EA85608043E4790B5BF87E5300DE98AB61667465588FC1B067C8E8E3F77FD68CFCE8501D7E09C32AA3244CF448E90BA412194FF629F85F4D9110B260759606DA2E136AFACE5A9C96DEB163 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojWBddABnKmoIGdch3aB6GoQ== X-Mailru-Sender: B5B6A6EBBD94DAD8DF9DB9650A8885C83671B891BF31F74D71AFCD6F5534DC61949B8B3534359B341EC9E4A2C82A33BC8C24925A86E657CE0C70AEE3C9A96FBAB3D7EE8ED63280BE112434F685709FCF0DA7A0AF5A3A8387 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH resend v2 06/11] box, datetime: datetime comparison for indices X-BeenThere: tarantool-patches@dev.tarantool.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: Tarantool development patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Timur Safin via Tarantool-patches Reply-To: Timur Safin Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Hello Oleg, : From: Oleg Babin : Subject: Re: [Tarantool-patches] [PATCH resend v2 06/11] box, datetime: : datetime comparison for indices : : 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' : ... : : ``` Oh, shit, I didn't take those operations into considerations. Do they work similarly with decimal? : : : 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? Good question! Yeah, there should be original values compared, without stringization. (And in this case, by some reason, it's easier to reproduce problem of incorrect sort ofder with sequential times from date.now(). Which used to be reproduced only on some configs at GH) : : : > + err = {a[i][1], a[i+1][1]}\ : > + break\ : > + end\ : > +end : > + | --- : > + | ... : > + : > +err : > + | --- : > + | - null : > + | ... : > +box.space.T:drop() : > + | --- : > + | ... : >