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. Syntax CREATE FUNCTION {function_name} as ({parameters}) -> {function core}. Example CREATE FUNCTION plus_one as (a) -> a + 1. Authors @Realist007. #27796 (Maksim Kita) #23978 (Realist007).
Introduces the ability to create user-defined functions (UDFs) as lambda expressions using a new concise syntax.

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 the CREATE FUNCTION statement with the syntax:
CREATE FUNCTION {function_name} as ({parameters}) -> {function core}

For example:
CREATE FUNCTION plus_one as (a) -> a + 1