From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from localhost (localhost [127.0.0.1]) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTP id 40E8E25596 for ; Tue, 13 Aug 2019 05:45:58 -0400 (EDT) Received: from turing.freelists.org ([127.0.0.1]) by localhost (turing.freelists.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id ko4SbIL-3JeU for ; Tue, 13 Aug 2019 05:45:58 -0400 (EDT) Received: from smtpng3.m.smailru.net (smtpng3.m.smailru.net [94.100.177.149]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by turing.freelists.org (Avenir Technologies Mail Multiplex) with ESMTPS id 9530A25553 for ; Tue, 13 Aug 2019 05:45:57 -0400 (EDT) Subject: [tarantool-patches] Re: [PATCH v2 7/8] sql: get rid of FuncDef function hash References: <29c44d7790720584498ca1763cb28ff98e35c71d.1565275470.git.kshcherbatov@tarantool.org> <20190812221150.GU32337@atlas> <28e7766a-0374-36ab-d848-a533106dedda@tarantool.org> <20190813084246.GA5284@atlas> From: Kirill Shcherbatov Message-ID: Date: Tue, 13 Aug 2019 12:45:52 +0300 MIME-Version: 1.0 In-Reply-To: <20190813084246.GA5284@atlas> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: tarantool-patches-bounce@freelists.org Errors-to: tarantool-patches-bounce@freelists.org Reply-To: tarantool-patches@freelists.org List-Help: List-Unsubscribe: List-software: Ecartis version 1.0.0 List-Id: tarantool-patches List-Subscribe: List-Owner: List-post: List-Archive: To: Konstantin Osipov , Tarantool MailList Cc: Nikita Pettik >> 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.