v.21.8Improvement

Allow Arbitrary Expressions in Parametric Aggregate Functions

Allow parameters for parametric aggregate functions to be arbitrary constant expressions (e.g., 1 + 2), not just literals. It also allows using the query parameters (in parameterized queries like {param:UInt8}) inside parametric aggregate functions. Closes #11607. #25910 (alexey-milovidov).
Parametric aggregate functions now accept arbitrary constant expressions and query parameters, not just literal values.

Why it matters

This feature enhances flexibility by allowing users to pass complex constant expressions (e.g., 1 + 2) and parameterized query variables (e.g., {param:UInt8}) to parametric aggregate functions. It simplifies query writing and improves integration with parameterized queries.

How to use it

Users can pass any constant expressions or query parameters inside parametric aggregate functions in their SQL queries. For example, instead of providing only literals, expressions like
SELECT aggregateFunction(1 + 2, column) FROM table
or parameter placeholders like
SELECT aggregateFunction({param:UInt8}, column) FROM table
are now supported.