Hi, In general it is a good idea, but I doubt about this flag being required for each UDF. It is that it would be ignored (or lead to an exception) in most cases:
- The function has an argument - The engine is not fit (H2) I incline to decide to add the flag in CalciteQueryEngineConfiguration, and it will be applied to all functions. On Fri, Nov 6, 2026 at 9:15 AM Kirill Tkalenko <[email protected]> wrote: > Hi all, > > I'd like to propose allowing user-defined SQL functions to be called > without parentheses in the Calcite query engine. > > Several DBMSs support this syntax for built-in functions, such as > CURRENT_USER in PostgreSQL and CURRENT_TIMESTAMP in SQL Server. > Oracle also supports calls without parentheses for parameterless UDFs. > > This could be useful for functions exposing session or application > context, such as the current tenant, application user, or session > identifier. > > I propose adding an opt-in parameter to > org.apache.ignite.cache.query.annotations.QuerySqlFunction: > > boolean allowWithoutParentheses() default false; > > For example: > > @QuerySqlFunction( > alias = "CURRENT_TENANT", > allowWithoutParentheses = true > ) > public String currentTenant() { > return sessionContextProvider.getSessionContext() > .getAttribute("tenant"); > } > > After registering the function through > CacheConfiguration.setSqlFunctionClasses, it could be used as follows: > > SELECT * FROM orders WHERE tenant_id = CURRENT_TENANT; > SELECT * FROM orders WHERE tenant_id = CURRENT_TENANT(); > > This option would be supported only by the Calcite query engine. > The default value would preserve existing behavior. > Enabling it for a function with parameters would result in a registration > error. > > WDYT? > -- Vladislav Pyatkov
