Skip to main content

ARRAY_COMPACT

Categories: Semi-Structured Data

ARRAY_COMPACT

Returns the input array without null values.

Syntax

ARRAY_COMPACT(arr LIST) → list

  • arr: The array from which to remove null values.

Examples

array_col contains ARRAY[1, NULL, 2, NULL]
SELECT ARRAY_COMPACT(array_col)
-- [1, 2]