v.21.1Improvements

When using -OrNull with other combinators, prioritize -OrNull placement

When -OrNull combinator combined -If, -Merge, -MergeState, -State combinators, we should put -OrNull in front. #16935 (flynn).
Clarified and enforced the correct order of combinators when using -OrNull combined with -If, -Merge, -MergeState, and -State in ClickHouse aggregate functions.

Why it matters

To ensure consistent and predictable behavior of aggregate functions by requiring that the -OrNull combinator is always placed before other combinators like -If, -Merge, -MergeState, and -State. This prevents unexpected results and simplifies the aggregation logic for users.

How to use it

When combining aggregate function combinators, always place -OrNull at the beginning of the combinator chain before others like -If, -Merge, -MergeState, or -State. For example, use aggFunctionOrNullIf instead of aggFunctionIfOrNull.