inline_outer table-valued generator function

Explodes an array of structs into a table with OUTER semantics.

Syntax

inline_outer(expr)

Arguments

  • expr: An ARRAY<STRUCT> expression.

Returns

A set of rows composed of the other expressions in the select list and the fields of the structs.

If expr is NULL, or the array is empty a single row with nulls for the attributes is produced.

inline can only be placed in the select list or a LATERAL VIEW. When placing the function in the select list there must be no other generator function in the same select list.

The columns produced by inline_outer are named “col1”, “col2”, etc by default, but can be aliased using an alias tuple such as AS (myCol1, myCol2).

Examples

> SELECT inline_outer(array(struct(1, 'a'), struct(2, 'b')));
 1  a
 2  b