On this page

    Categories: Conversion

    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

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