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 914D86E454; Thu, 10 Feb 2022 12:21:46 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org 914D86E454 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1644484906; bh=vpz6cEC4lbxMsAWtp8f2p8XDrJPdzOpAM6oRdBRsOUI=; h=Date:To:Cc:References:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=M3x0sETTDNF3u4j2RN3Jg3E8suKK6nJeKnkgUP3usX0PENmdEGB1wmefbuMaSaPwD mA1jorm+GkZ0sh3Yc4jGr6cBJTGwC/4d1VU72Ht+HVEpOQb/RSxtZTm3dEE/pKiE3H 7Do/2m60wcJe0wk+tGQq2x5QkN74E/tDWRSP5EB0= 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 ED79D6E454 for ; Thu, 10 Feb 2022 12:21:44 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org ED79D6E454 Received: by smtp47.i.mail.ru with esmtpa (envelope-from ) id 1nI5e4-0000bG-9r; Thu, 10 Feb 2022 12:21:44 +0300 Date: Thu, 10 Feb 2022 12:21:42 +0300 To: Vladislav Shpilevoy Cc: tarantool-patches@dev.tarantool.org Message-ID: <20220210092142.GA67603@tarantool.org> References: <162eb863bee6a45a63ee85604ce004d83e8aedfa.1643722506.git.imeevma@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: X-4EC0790: 10 X-7564579A: B8F34718100C35BD X-77F55803: 4F1203BC0FB41BD9B74B50284A7C1A0B1BCE06C34C5A694E3AC40405103F0D82182A05F538085040E0F481E34F2CD27891A83C3AC0081EB2F3C5BBDEC1E32073CC2F8C14F96A5AB5 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE711269A7C2F827F16EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637D7F1BE85E7B0CA818638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8598FB30ECECBFBFB9BEE9C0FF32E2685117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC8C7ADC89C2F0B2A5A471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F446042972877693876707352033AC447995A7AD18F04B652EEC242312D2E47CDBA5A96583BA9C0B312567BB2376E601842F6C81A19E625A9149C048EE042285CD7A5C321F7C6FCE95544A9834D8FC6C240DEA7642DBF02ECDB25306B2B78CF848AE20165D0A6AB1C7CE11FEE3672DC5A730DF09D2AD7EC71F1DB88427C4224003CC836476EA7A3FFF5B025636E2021AF6380DFAD1A18204E546F3947CB11811A4A51E3B096D1867E19FE1407959CC434672EE6371089D37D7C0E48F6C8AA50765F7900637A7EFCB0EB5ACB161EFF80C71ABB335746BA297DBC24807EABDAD6C7F3747799A X-8FC586DF: 6EFBBC1D9D64D975 X-C1DE0DAB: 0D63561A33F958A5125E14167316CA84F2195366E8943E02496A7998A632D719D59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7506FE1F977233B9BB410CA545F18667F91A7EA1CDA0B5A7A0 X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D346EDE9E12965E8CD552C83DD216367877FA3B017B190A2102E624C2D5C09C48173FBDA8EAFBF234921D7E09C32AA3244C8EE1F1D1881A2D57A0D60AC63C0C46723A76366E8A9DE7CA729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2biojptAT+HCMDqM+Xud2cbUIrA== X-Mailru-Sender: 5C3750E245F362008BC1685FEC6306EDC9B15330BBCD86FF91A83C3AC0081EB2FA95C477BC5130F85105BD0848736F9966FEC6BF5C9C28D97E07721503EA2E00ED97202A5A4E92BF72D6B4FCE48DF648AE208404248635DF X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v2 4/4] sql: introduce FINALIZE for custom aggregate 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: Mergen Imeev via Tarantool-patches Reply-To: Mergen Imeev Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" hi! Thank you for the review! My answer below. On Fri, Feb 04, 2022 at 12:30:24AM +0100, Vladislav Shpilevoy wrote: > Thanks for the patch! > > > Example: > > ``` > > box.schema.func.create("F1_finalize", { > > language = "Lua", > > body = [[ > > function(state) > > if state == nil then > > return 0 > > end > > return state.sum / state.count > > end > > ]], > > param_list = {"map"}, > > returns = "number", > > exports = {'LUA', 'SQL'}, > > }) > > I thought of another approach - let to call the function any name, > make {aggregate = "finalize", source = "F1"}. So it is like a foreign > key. But up to you whether you like it and whether you will try to bring > it up with the product managers. > I tried two more approaches, but in the end I decided to leave it as it is for now. Both approaches get too complicated when I have to deal with transactions. > > box.execute('SELECT f1(i) FROM t;') > > The commit technically LGTM.