v.21.8Improvement

Fix GROUP BY Constant Behavior on Empty Set

Fix inconsistent behaviour of GROUP BY constant on empty set. Closes #6842. #25786 (Kseniia Sumarokova).
Fix the inconsistent behavior of GROUP BY when grouping by a constant on an empty dataset.

Why it matters

This update resolves inconsistencies that occurred when using GROUP BY with a constant expression on an empty input set. Previously, the query result could behave unpredictably or differ from expected SQL standards. The fix ensures consistent and standard-compliant aggregation results even when the input is empty, improving reliability and user confidence in query results.

How to use it

No special action is required by users to enable this fix. Queries that involve GROUP BY constant expressions on empty tables will automatically exhibit consistent and corrected behavior after upgrading to this ClickHouse version.