[Tarantool-patches] [PATCH v2 4/4] sql: introduce FINALIZE for custom aggregate
Vladislav Shpilevoy
v.shpilevoy at tarantool.org
Fri Feb 4 02:30:24 MSK 2022
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.
> box.execute('SELECT f1(i) FROM t;')
The commit technically LGTM.
More information about the Tarantool-patches
mailing list