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 B466174147; Tue, 5 Oct 2021 00:54:21 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B466174147 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=tarantool.org; s=dev; t=1633384461; bh=o8cPSlt9d7m3lzLI5jxluVhNesZYZMIbhWh5JvXzkvo=; h=To:Cc:References:Date:In-Reply-To:Subject:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From:Reply-To:From; b=ZdcYu7JGwvgJhUmK+qrt//82+FqZC6wFLX0xge/lBrtKfo/wZuPW/iPujF520nusz 37Lk92O8hGkJfYR+7cFMTlDhjrPFIMGcMSd7Kf+s5t0ZP9O2B6v0BSbAQfOdCq6S2O xxRzqnwsrz4zRiJ1ccIkKux0AvhNgPeF23nIyLYg= Received: from smtpng1.i.mail.ru (smtpng1.i.mail.ru [94.100.181.251]) (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 B0E6B74147 for ; Tue, 5 Oct 2021 00:53:51 +0300 (MSK) DKIM-Filter: OpenDKIM Filter v2.11.0 dev.tarantool.org B0E6B74147 Received: by smtpng1.m.smailru.net with esmtpa (envelope-from ) id 1mXVuB-0007pB-6Z; Tue, 05 Oct 2021 00:53:51 +0300 To: imeevma@tarantool.org Cc: tarantool-patches@dev.tarantool.org References: Message-ID: <32c9fec9-30b6-f213-3a49-8772be433e99@tarantool.org> Date: Mon, 4 Oct 2021 23:53:50 +0200 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-7564579A: EEAE043A70213CC8 X-77F55803: 4F1203BC0FB41BD9064ADF4728AA0EE956D43A9B567FDD9A8B13701973EA0578182A05F538085040CE3164A3A4FD741A227DF8705A907949C1317720E527625D6614F5731B43D564 X-7FA49CB5: FF5795518A3D127A4AD6D5ED66289B5278DA827A17800CE7798B95EC47D21699EA1F7E6F0F101C67BD4B6F7A4D31EC0BCC500DACC3FED6E28638F802B75D45FF8AA50765F7900637F907CB39E8CA2E228638F802B75D45FF36EB9D2243A4F8B5A6FCA7DBDB1FC311F39EFFDF887939037866D6147AF826D8BCF202D21F9402734C216DC4976B5866117882F4460429724CE54428C33FAD305F5C1EE8F4F765FC1A9C11735BBA05FBA471835C12D1D9774AD6D5ED66289B52BA9C0B312567BB23117882F44604297287769387670735209647ADFADE5905B1618001F51B5FD3F9D2E47CDBA5A96583BA9C0B312567BB231DD303D21008E29813377AFFFEAFD269A417C69337E82CC2E827F84554CEF50127C277FBC8AE2E8BA83251EDC214901ED5E8D9A59859A8B613439FA09F3DCB32089D37D7C0E48F6C5571747095F342E88FB05168BE4CE3AF X-B7AD71C0: AC4F5C86D027EB782CDD5689AFBDA7A213B5FB47DCBC3458834459D11680B505C0B97CAE4A76F82FA5953163EDDB7C26 X-C1DE0DAB: 0D63561A33F958A56D6E4954DA26BF280CEE0DE1A3C5D4959D9B32EE4A20FDFFD59269BC5F550898D99A6476B3ADF6B47008B74DF8BB9EF7333BD3B22AA88B938A852937E12ACA7557E988E9157162368E8E86DC7131B365E7726E8460B7C23C X-C8649E89: 4E36BF7865823D7055A7F0CF078B5EC49A30900B95165D349320586B19AD2C7237F58FE95DF6261D61C16F02AF5C37F6BC01DC1557AE520BD94C35B3656720711D7E09C32AA3244C3B2E38843AE5E6D775111D3993DDEE5863871F383B54D9B3729B2BEF169E0186 X-D57D3AED: 3ZO7eAau8CL7WIMRKs4sN3D3tLDjz0dLbV79QFUyzQ2Ujvy7cMT6pYYqY16iZVKkSc3dCLJ7zSJH7+u4VD18S7Vl4ZUrpaVfd2+vE6kuoey4m4VkSEu530nj6fImhcD4MUrOEAnl0W826KZ9Q+tr5ycPtXkTV4k65bRjmOUUP8cvGozZ33TWg5HZplvhhXbhDGzqmQDTd6OAevLeAnq3Ra9uf7zvY2zzsIhlcp/Y7m53TZgf2aB4JOg4gkr2bioj+1ww+tpaZerxk/1dDQCGTg== X-Mailru-Sender: 689FA8AB762F7393C37E3C1AEC41BA5D4954117C2DFF31A96ECABC46D6E0C5DB3841015FED1DE5223CC9A89AB576DD93FB559BB5D741EB963CF37A108A312F5C27E8A8C3839CE0E267EA787935ED9F1B X-Mras: Ok Subject: Re: [Tarantool-patches] [PATCH v4 11/16] sql: refactor COUNT() function 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: Vladislav Shpilevoy via Tarantool-patches Reply-To: Vladislav Shpilevoy Errors-To: tarantool-patches-bounces@dev.tarantool.org Sender: "Tarantool-patches" Nicely done! On 01.10.2021 14:48, imeevma@tarantool.org wrote: > Part of #4145 > --- > src/box/sql/func.c | 64 +++++++++++++++++++--------------------------- > 1 file changed, 26 insertions(+), 38 deletions(-) > > diff --git a/src/box/sql/func.c b/src/box/sql/func.c > index 94ec811ef..384c68be8 100644 > --- a/src/box/sql/func.c > +++ b/src/box/sql/func.c > @@ -154,6 +154,29 @@ fin_avg(struct sql_context *ctx) > ctx->is_aborted = true; > } > > +/** Implementation of the COUNT() function. */ > +static void > +step_count(struct sql_context *ctx, int argc, struct Mem **argv) > +{ > + assert(argc == 0 || argc == 1); > + if (mem_is_null(ctx->pMem)) > + mem_set_uint(ctx->pMem, 0); Would be nice to have a 'begin' step for the aggregation functions. This would allow to eliminate these 'if is null' ifs in some step functions in favor of having +1 virtual 'begin' call in the beginning. Do you think it would simplify/speed up things? If you agree, could you please create a ticket for that? As 'good first issue' even. If don't agree, then ignore this comment.