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 6756725739 for ; Mon, 12 Aug 2019 18:11:52 -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 rqCuCQad3utM for ; Mon, 12 Aug 2019 18:11:52 -0400 (EDT) Received: from smtp48.i.mail.ru (smtp48.i.mail.ru [94.100.177.108]) (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 2328625735 for ; Mon, 12 Aug 2019 18:11:52 -0400 (EDT) Date: Tue, 13 Aug 2019 01:11:50 +0300 From: Konstantin Osipov Subject: [tarantool-patches] Re: [PATCH v2 7/8] sql: get rid of FuncDef function hash Message-ID: <20190812221150.GU32337@atlas> References: <29c44d7790720584498ca1763cb28ff98e35c71d.1565275470.git.kshcherbatov@tarantool.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <29c44d7790720584498ca1763cb28ff98e35c71d.1565275470.git.kshcherbatov@tarantool.org> 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: tarantool-patches@freelists.org Cc: korablev@tarantool.org, Kirill Shcherbatov * Kirill Shcherbatov [19/08/08 17:53]: I like the patch, there is only one nit here: > -void > -sqlRegisterBuiltinFunctions(void) > +static struct { > + const char *name; > + uint64_t signature_mask; > + enum field_type returns; > + uint16_t flags; > + void (*call)(sql_context *ctx, int argc, sql_value **argv); > + void (*finalize)(sql_context *ctx); > + void *user_data; > + enum func_aggregate aggregate; > + bool is_deterministic; > +} sql_builtins[] = { > + REG_FUNC("ABS", ARGC_MASK(1), FIELD_TYPE_NUMBER, 0, > + absFunc, NULL, true), This looks like huge overengineering. A bunch of macros, a binary search, can you just open-code inserting all of these functions into the hash? It would be perhaps a bit more copy-paste, but it will be easy to maintain. Am I missing something? -- Konstantin Osipov, Moscow, Russia