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 4071B6EC40; Tue, 17 Aug 2021 22:05:19 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 4071B6EC40 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1629227119; bh=1eio5M54soZvG4E5eRUf3rD1vzHYQlzWufAELIel54c=; h=Date:To:References:In-Reply-To:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=w57xFkD6ggfIMmGimhlCiBCWqfQI4h+700ZtXHUiv7bieEllsruXU7GXHMVh5w/pA TJ1AomnHHmVsU1aOFWxKgVvMT016QmulNvUx/gOeqg7zF1GQYDsq1jlA+b2uLC2d+e Sq8sP+qC0NyHVUrZtDWxlgJ3q8L58+ha6LtekgCc= Received: from smtp60.i.mail.ru (smtp60.i.mail.ru [217.69.128.40]) (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 0F9CB6EC40 for ; Tue, 17 Aug 2021 22:05:18 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 0F9CB6EC40 Received: by smtp60.i.mail.ru with esmtpa (envelope-from ) id 1mG4Oj-0004dR-2g; Tue, 17 Aug 2021 22:05:17 +0300 Date: Tue, 17 Aug 2021 22:05:15 +0300 To: Timur Safin via Tarantool-patches Message-ID: <20210817190515.gfvarox63jvltiti@esperanza> References: <906cfac8b66b70eb982b5c7fe4878da39712a305.1629071531.git.tsafin@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <906cfac8b66b70eb982b5c7fe4878da39712a305.1629071531.git.tsafin@tarantool.org> X-7564579A: 646B95376F6C166E X-77F55803: 4F1203BC0FB41BD92087353F0EC44DD9736CF3E71F18CE0C3E1D5927724F4AAA182A05F5380850408C4CA6B95AFCEEA6B303F17FFEB58DBFBC244D039BAB249A6F503AA6E9AD48E6 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE761966F250AC1AE21EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637C8DFB935205A313D8638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D89F29BCB6497DDE84128247EFFB63B78D117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC974A882099E279BDA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352026055571C92BF10F28451B159A507268D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE042285CD7A5C321F7F16001415B11694D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE34B6F6234D9065C97BA3038C0950A5D36B5C8C57E37DE458B0BC6067A898B09E46D1867E19FE14079C09775C1D3CA48CF3D321E7403792E342EB15956EA79C166A417C69337E82CC275ECD9A6C639B01B78DA827A17800CE74ABCC139FF3F849B731C566533BA786AA5CC5B56E945C8DA X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458F0AFF96BAACF4158235E5A14AD4A4A4625E192CAD1D9E79D0B18DC6AC13D9A1C08724C08D057816B X-C1DE0DAB: 0D63561A33F958A5925BC03290A1030A72F69B352BBDDC1762BB0D91F3505702D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7567C209D01CC1E34B410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D34FACF503ACC83041B8D17345086BA02DAD5ED3D9C899BB725D5FF8485CD2B66FA4C680DB3A13F807C1D7E09C32AA3244CA115256D38BE5D90FA2524EC7B40E9557C0C08F7987826B983B48618A63566E0 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojuRQ/H5n28tp1PpF3NIilRw== X-Mailru-Sender: EAC3DA4C40F0802FC8DB1BBF04B7D9F21A7CD5B34F2971D8036D897B461128093A7A9A8B07ACFACAF0798C444D2DF93A342CD0BA774DB6A9B195EA2AC6D0D44E902A426E4A0C259E9437F6177E88F7363CDA0F3B3F5B9367 X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v5 5/8] 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: Vladimir Davydov via Tarantool-patches Reply-To: Vladimir Davydov Cc: v.shpilevoy@tarantool.org Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" On Mon, Aug 16, 2021 at 02:59:39AM +0300, Timur Safin via Tarantool-patches wrote: > diff --git a/test/engine/datetime.test.lua b/test/engine/datetime.test.lua > new file mode 100644 > index 000000000..3685e4d4b > --- /dev/null > +++ b/test/engine/datetime.test.lua > @@ -0,0 +1,35 @@ > +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')} We need more tests. Off the top of my head: - unique constraint - multi-part indexes - index:get(key) / index:select(key) - index:replace - index:update / index:upsert - dates before unix epoch and very big dates - hint corner cases (when two different dates have the same hint) - snapshot and recovery > + > +o = box.space.T:select{} > +assert(tostring(o[1][1]) == '1970-01-01T00:00Z') > +assert(tostring(o[2][1]) == '1970-01-02T00:00Z') > +assert(tostring(o[3][1]) == '1970-01-03T00:00Z') > +assert(tostring(o[4][1]) == '2000-01-01T00:00Z') > + > +for i = 1,16 do\ > + box.space.T:insert{date.now()}\ > +end Please don't use now(), because it'd make it difficult to reproduce a failure. > + > +a = box.space.T:select{} > +err = {} > +for i = 1, #a - 1 do\ > + if a[i][1] >= a[i+1][1] then\ > + table.insert(err, {a[i][1], a[i+1][1]})\ > + break\ > + end\ > +end > + > +err > +box.space.T:drop()