[Tarantool-patches] [PATCH v2 4/4] sql: introduce FINALIZE for custom aggregate
Mergen Imeev
imeevma at tarantool.org
Thu Feb 10 12:21:42 MSK 2022
hi! Thank you for the review! My answer below.
On Fri, Feb 04, 2022 at 12:30:24AM +0100, Vladislav Shpilevoy wrote:
> Thanks for the patch!
>
> > Example:
> > ```
> > box.schema.func.create("F1_finalize", {
> > language = "Lua",
> > body = [[
> > function(state)
> > if state == nil then
> > return 0
> > end
> > return state.sum / state.count
> > end
> > ]],
> > param_list = {"map"},
> > returns = "number",
> > exports = {'LUA', 'SQL'},
> > })
>
> I thought of another approach - let to call the function any name,
> make {aggregate = "finalize", source = "F1"}. So it is like a foreign
> key. But up to you whether you like it and whether you will try to bring
> it up with the product managers.
>
I tried two more approaches, but in the end I decided to leave it as it is for
now. Both approaches get too complicated when I have to deal with transactions.
> > box.execute('SELECT f1(i) FROM t;')
>
> The commit technically LGTM.
More information about the Tarantool-patches
mailing list