[Tarantool-patches] [PATCH v2 07/15] sql: rework SUM()

Vladislav Shpilevoy v.shpilevoy at tarantool.org
Thu Sep 23 01:48:13 MSK 2021


Thanks for the patch!

> diff --git a/src/box/sql/func.c b/src/box/sql/func.c
> index b4461c6ee..b06955302 100644
> --- a/src/box/sql/func.c
> +++ b/src/box/sql/func.c
> @@ -53,6 +53,29 @@
>  static struct mh_strnptr_t *built_in_functions = NULL;
>  static struct func_sql_builtin **functions;
>  
> +/** Implementation of the SUM() function. */
> +static void
> +step_sum(struct sql_context *ctx, int argc, struct Mem **argv)
> +{
> +	assert(argc == 1);
> +	(void)argc;
> +	assert(ctx->pMem->type == MEM_TYPE_NULL || mem_is_num(ctx->pMem));
> +	if (argv[0]->type == MEM_TYPE_NULL)

Probably we should use mem_is_null() where possible. To avoid
Mem members manual touch out of Mem.h and Mem.c. Here and in other
places, other commits. Sorry I didn't notice it before.


More information about the Tarantool-patches mailing list