v.19.16New Feature

Add Aggregate Function Combinators -ornull and -ordefault, Which Return Null or Default Values When There Is Nothing to Aggregate

Add aggregate function combinators -OrNull and -OrDefault, which return null or default values when there is nothing to aggregate. #7331 (hcz)
Added aggregate function combinators -OrNull and -OrDefault that return null or default values respectively when there is nothing to aggregate.

Why it matters

These combinators solve the problem of aggregate functions returning no result (empty aggregation), providing a way to output null or a specified default value instead. This improves query robustness and makes handling empty aggregations more convenient.

How to use it

Use the new combinators by appending -OrNull or -OrDefault to existing aggregate function names. For example, count-OrNull() returns null when no rows match, and sum-OrDefault() returns zero or the aggregate's default value in that case.