Skip to main content
Version: current [24.3.x]

FLATTEN

Categories: Semi-Structured Data

FLATTEN

Explodes compound values into multiple rows. This function takes a LIST column and produces a lateral view (that is, an inline view that contains correlation referring to other tables that precede it in the FROM clause).

Syntax

FLATTEN(expression list) → list

  • expression: The expression that will be unpacked into rows. The expression must be of data type LIST.

Examples

FLATTEN example
SELECT FLATTEN(CONVERT_FROM ('["Ford", "BMW", "Fiat"]', 'json'))
-- Ford
-- BMW
-- Fiat