v.21.10Improvements

Add Setting for Grouping by Constant Keys on Empty Set

Add a setting empty_result_for_aggregation_by_constant_keys_on_empty_set to control the behavior of grouping by constant keys on empty set. This is to bring back the old behavior of #6842. #27932 (Amos Bird).
Introduces the setting empty_result_for_aggregation_by_constant_keys_on_empty_set to control the behavior of aggregation queries that group by constant keys on an empty dataset.

Why it matters

This feature addresses the need to revert to the previous behavior where aggregation by constant keys on an empty set produces an empty result, solving inconsistencies introduced by recent changes. It allows users to choose between returning an empty result or the new default behavior, improving query result predictability.

How to use it

Enable or disable the behavior by setting empty_result_for_aggregation_by_constant_keys_on_empty_set to true or false respectively in the query settings or server configuration. For example:

SET empty_result_for_aggregation_by_constant_keys_on_empty_set = 1;


This will restore the old aggregation behavior on empty input sets.