New function: ARRAY_FLATTEN may conflict with similarly named UDFs

Attention

This behavior change is in the 2023_06 bundle.

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

In the current Snowflake release, Snowflake has introduced a new built-in function named ARRAY_FLATTEN.

ARRAY_FLATTEN flattens an ARRAY of ARRAYs into a single ARRAY.

  • If the ARRAY is nested more than two levels deep, then only a single level of nesting is removed.

  • If the input ARRAY is NULL or contains any NULL elements, then the result is NULL.

If you have a UDF named ARRAY_FLATTEN, this behavior change has the following effect:

Previously:

Calls to ARRAY_FLATTEN resolve to your UDF.

Currently:

Calls to ARRAY_FLATTEN will resolve to the new built-in ARRAY_FLATTEN function.

The built-in ARRAY_FLATTEN function might work differently than your UDF.

If the documented semantics of the new built-in ARRAY_FLATTEN function does not match the semantics of your UDF, you can either:

  • Rename your UDF (using ALTER FUNCTION … RENAME TO …) and replace all references to the original UDF name with the new name.

  • Fully qualify all references to your UDF by specifying the names of the database and schema containing the UDF. For example:

    SELECT my_database.my_schema.array_flatten(...);
    
    Copy

Ref: 1239