From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 0CD0429C44 for ; Mon, 25 Mar 2019 11:13:52 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id sRSI5x48EGpc for ; Mon, 25 Mar 2019 11:13:51 -0400 (EDT) Received: from smtpng1.m.smailru.net (smtpng1.m.smailru.net [94.100.181.251]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id BA7C529CAB for ; Mon, 25 Mar 2019 11:13:51 -0400 (EDT) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 12.2 \(3445.102.3\)) Subject: [tarantool-patches] Re: [PATCH 08/13] sql: aggregate sql functions support big int From: "n.pettik" In-Reply-To: Date: Mon, 25 Mar 2019 18:13:49 +0300 Content-Transfer-Encoding: 7bit Message-Id: References: Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: tarantool-patches@freelists.org Cc: szudin@tarantool.org > On 15 Mar 2019, at 18:45, Stanislav Zudin wrote: > > Makes sql functions avg() and sum() accept arguments with > values in the range [2^63, 2^64). > --- > src/box/sql/func.c | 35 ++++++++++++++++++++++++++++++----- > src/box/sql/sqlInt.h | 3 +++ > src/box/sql/vdbeapi.c | 6 ++++++ > 3 files changed, 39 insertions(+), 5 deletions(-) > > diff --git a/src/box/sql/func.c b/src/box/sql/func.c > index 8a8acc216..194dec252 100644 > --- a/src/box/sql/func.c > +++ b/src/box/sql/func.c > @@ -1410,6 +1410,7 @@ struct SumCtx { > i64 cnt; /* Number of elements summed */ > u8 overflow; /* True if integer overflow seen */ > u8 approx; /* True if non-integer value was input to the sum */ > + u8 is_unsigned; /* True if value exceeded 2^63 */ Bool is enough. > diff --git a/src/box/sql/sqlInt.h b/src/box/sql/sqlInt.h > index 7f8e3f04e..c43d8c193 100644 > --- a/src/box/sql/sqlInt.h > +++ b/src/box/sql/sqlInt.h > @@ -495,6 +495,9 @@ sql_result_int(sql_context *, int); > void > sql_result_int64(sql_context *, sql_int64); > > +void > +sql_result_uint64(sql_context *, sql_uint64); > + Add test cases verifying that aggregate functions can handle uints.