v.21.10New Features
Add User-Defined Functions (UDF) as Lambda Expressions in ClickHouse
Add feature for creating user-defined functions (UDF) as lambda expressions. SyntaxCREATE FUNCTION {function_name} as ({parameters}) -> {function core}. ExampleCREATE FUNCTION plus_one as (a) -> a + 1. Authors @Realist007. #27796 (Maksim Kita) #23978 (Realist007).
Why it matters
This feature allows users to define custom reusable functions directly within ClickHouse queries, enabling more flexible and modular expressions. It simplifies complex query logic by encapsulating it in named functions, improving code readability and maintainability.How to use it
Use theCREATE FUNCTION statement with the syntax:CREATE FUNCTION {function_name} as ({parameters}) -> {function core}For example:
CREATE FUNCTION plus_one as (a) -> a + 1