v.22.7New Feature

Add group_by_use_nulls Setting for Nullable Aggregation Keys in ROLLUP, CUBE, and GROUPING SETS

Add group_by_use_nulls setting to make aggregation key columns nullable in the case of ROLLUP, CUBE and GROUPING SETS. Closes #37359. #38642 (Dmitry Novik).
Introduces the group_by_use_nulls setting to make aggregation key columns nullable when using ROLLUP, CUBE, and GROUPING SETS.

Why it matters

This feature addresses the issue of handling aggregation keys during complex grouping operations by allowing key columns to be nullable. It improves clarity and correctness in result sets involving ROLLUP, CUBE, and GROUPING SETS by explicitly representing missing grouping keys as NULL.

How to use it

Enable the feature by setting group_by_use_nulls = 1 in your query settings. For example, you can set it globally, per session, or inline with a query using:

sql<br>SET group_by_use_nulls = 1;<br>SELECT ... FROM ... GROUP BY ROLLUP(...);<br>