[tarantool-patches] Re: [PATCH v2 7/8] sql: get rid of FuncDef function hash
Kirill Shcherbatov
kshcherbatov at tarantool.org
Tue Aug 13 12:45:52 MSK 2019
>> I like this concept because it is uniform and all implementation-dependent
>> details (like the completion of the function definition initialization) are hidden
>> in the corresponding module (sql/func.c).
>
> What does this code do? Why do you need an anonymous structure,
> instead of initializing struct func_sql_builtn object right away?
> What do you need the binary search for?
> Pre-ordering the array for the binary search is very fragile.
This new anonymous structure contain information both to complete
func_sql_builtn construction and func_def initialization.
...
func->flags = sql_builtins[idx].flags;
func->user_data = sql_builtins[idx].user_data;
func->call = sql_builtins[idx].call;
...
def->is_deterministic = sql_builtins[idx].is_deterministic;
def->returns = sql_builtins[idx].returns;
def->aggregate = sql_builtins[idx].aggregate;
def->exports.sql = true;
...
(def is an func_sql_builtin_new constructor argument)
The binary search is required to find corresponding metadata entry in
func_sql_builtin_new constructor.
> Can this be coded in Lua, in upgrade.lua?
I mean in current implementation you need to add a snapshoot entry to
introduce a new function AND define a metadata entry in block with
binary search.
More information about the Tarantool-patches
mailing list