GROUP BY ROLLUP/CUBE/GROUPING SETS: full type-checking of null-eliminating grouping keys (Pending)

Attention

This behavior change is in the 2026_08 bundle.

For the current status of the bundle, refer to Bundle history.

When a key used in ROLLUP, CUBE, or GROUPING SETS appears inside a null-eliminating expression such as IFNULL, the key can be NULL at grouping levels where it is omitted. With the 2026_08 bundle enabled, Snowflake treats the expression as potentially nullable during type-checking and continues checking later arguments in COALESCE.

Before the change:

An IFNULL expression is ordinarily non-null, so COALESCE can treat later arguments as unreachable. Before this change, a grouping-set key inside that IFNULL was not treated as nullable for this check, even though ROLLUP can omit it. A parse or conversion error in a later argument could therefore be ignored, allowing the query to return incorrect or inconsistent results.

For example, the invalid timestamp format in the following query could be skipped:

SELECT COALESCE(
    MAX(t1.COL9),
    IFNULL(DATEADD(day, t1.COL1, '2016-01-01'::DATE), '2016-01-02'::DATE),
    TO_TIMESTAMP(
        '2016-04-04 10:10:10.10 +07:00',
        'YYYY-MM-DD HH24:MI:SS.FFTZH'
    )
)
FROM func_test1 AS t1
GROUP BY ROLLUP(t1.COL1);
After the change:

When a grouping set can omit a key inside IFNULL, Snowflake treats the containing expression as potentially nullable during type-checking, even if it is non-null in practice. COALESCE therefore continues checking later arguments. In this example, Snowflake reports the error in the invalid TO_TIMESTAMP format instead of silently ignoring it and returning a result.

SELECT COALESCE(
    MAX(t1.COL9),
    IFNULL(DATEADD(day, t1.COL1, '2016-01-01'::DATE), '2016-01-02'::DATE),
    TO_TIMESTAMP(
        '2016-04-04 10:10:10.10 +07:00',
        'YYYY-MM-DD HH24:MI:SS.FFTZH'
    )
)
FROM func_test1 AS t1
GROUP BY ROLLUP(t1.COL1);

How to update your code

Review queries that use COALESCE or similar null-eliminating functions with ROLLUP, CUBE, or GROUPING SETS. Correct invalid expressions in later arguments; after the 2026_08 bundle is enabled, Snowflake reports errors in those arguments instead of potentially returning incorrect results.

Ref: 2435