v.20.12New Feature
Add aggregate_functions_null_for_empty setting for SQL standard compatibility
Add setting aggregate_functions_null_for_empty for SQL standard compatibility. This option will rewrite all aggregate functions in a query, adding -OrNull suffix to them. Implements 10273. #16123 (flynn).Why it matters
This feature addresses the discrepancy between ClickHouse aggregate functions and the SQL standard by making aggregate functions returnnull for empty input sets, improving query consistency and compatibility with SQL expectations.How to use it
Enable the feature by settingaggregate_functions_null_for_empty = 1 in the session or query settings. This will automatically rewrite aggregate functions to their -OrNull variants during query execution.