[tarantool-patches] Re: [PATCH 08/13] sql: aggregate sql functions support big int
n.pettik
korablev at tarantool.org
Mon Mar 25 18:13:49 MSK 2019
> On 15 Mar 2019, at 18:45, Stanislav Zudin <szudin at tarantool.org> 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.
More information about the Tarantool-patches
mailing list