v.24.11Improvement

Higher-order Functions Returning Constants

Higher-order functions with constant arrays and constant captured arguments will return constants. #58400 (Alexey Milovidov).
Higher-order functions in ClickHouse now return constant results when applied to constant arrays and constant captured arguments.

Why it matters

This feature optimizes query execution by allowing higher-order functions to evaluate to constants during query analysis when their inputs are constant. It improves performance by reducing runtime computation and enables better query optimizations.

How to use it

Simply use higher-order functions with constant arrays and constant captured arguments in your queries. The result will automatically be computed as a constant without any additional configuration.