Skip to main content
Table function
NULL input emits one NULL row; NULL array elements emit NULL values.

Syntax

Table

Arguments

Type notation used below:
  • T is the array element type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.
  • K is the map key type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.
  • V is the map value type: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.

Returns

  • Type: TABLE<col:T> or TABLE<key:K,value:V>
  • NULL behavior: NULL input emits one NULL row; NULL array elements emit NULL values.
  • Empty input: One NULL row for an empty collection.
  • Shape: One row per element/entry; aliases can name the generated columns.
  • Ordering: Array positions and map entry positions follow the input collection. Use ORDER BY to control output row order.

Properties

Usage notes

  • ARRAY emits one value column; MAP emits key and value columns.
  • INTEGER and INT mean the same type; STRING means VARCHAR text. NULL can be used with a supported type. Cast NULL explicitly when its type would otherwise be unclear.
  • Deterministic: The same inputs and settings produce the same result.

Examples

Typical behavior

Keep a NULL array as one row

Limitations

  • Exactly one ARRAY/MAP argument is required.
Last modified on October 15, 2026