Tarantool development patches archive
 help / color / mirror / Atom feed
From: Vladislav Shpilevoy via Tarantool-patches <tarantool-patches@dev.tarantool.org>
To: imeevma@tarantool.org
Cc: tarantool-patches@dev.tarantool.org
Subject: Re: [Tarantool-patches] [PATCH v2 1/3] sql: initialize MEM used in aggregate functions
Date: Thu, 29 Apr 2021 23:02:06 +0200	[thread overview]
Message-ID: <4b765060-a56e-e5d7-2b3a-5adb3a4bd40c@tarantool.org> (raw)
In-Reply-To: <05d176765118a7357b5b15d7fcfc08104463522c.1619542456.git.imeevma@gmail.com>

Hi! Thanks for the patch!

> diff --git a/src/box/sql/func.c b/src/box/sql/func.c
> index 9c28d5122..d282b2cea 100644
> --- a/src/box/sql/func.c
> +++ b/src/box/sql/func.c
> @@ -1798,14 +1798,13 @@ minmaxStep(sql_context * context, int NotUsed, sql_value ** argv)
>  static void
>  minMaxFinalize(sql_context * context)
>  {
> -	sql_value *pRes;
> -	pRes = (sql_value *) sql_aggregate_context(context, 0);
> -	if (pRes) {
> -		if (pRes->flags) {
> -			sql_result_value(context, pRes);
> -		}
> -		mem_destroy(pRes);
> -	}
> +	struct Mem *mem = context->pMem;
> +	struct Mem *res;
> +	if (!mem_is_agg(mem) || mem_get_agg(mem, (void **)&res) != 0)

You don't need `is_agg` check. `get` does the same already.

> +		return;
> +	if (!mem_is_null(res))
> +		sql_result_value(context, res);
> +	mem_destroy(res);
>  }

  reply	other threads:[~2021-04-29 21:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <cover.1619542456.git.imeevma@gmail.com>
2021-04-27 16:55 ` Mergen Imeev via Tarantool-patches
2021-04-29 21:02   ` Vladislav Shpilevoy via Tarantool-patches [this message]
2021-05-17 11:38     ` Mergen Imeev via Tarantool-patches
2021-04-27 16:55 ` [Tarantool-patches] [PATCH v2 2/3] sql: make mem_is_bin() to check only for VARBINARY Mergen Imeev via Tarantool-patches
2021-04-29 21:05   ` Vladislav Shpilevoy via Tarantool-patches
2021-05-17 12:05     ` Mergen Imeev via Tarantool-patches

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4b765060-a56e-e5d7-2b3a-5adb3a4bd40c@tarantool.org \
    --to=tarantool-patches@dev.tarantool.org \
    --cc=imeevma@tarantool.org \
    --cc=v.shpilevoy@tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v2 1/3] sql: initialize MEM used in aggregate functions' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox