All Products
Search
Document Center

MaxCompute:POSEXPLODE

Last Updated:Mar 26, 2026

POSEXPLODE converts an array into a two-column table: pos (zero-based index) and val (element value).

Syntax

posexplode(array<T> <a>)

Parameters

ParameterRequiredDescription
aYesAn array of any element type. T in array<T> represents the element data type.

Return value

Returns a table with two columns:

ColumnDescription
posThe zero-based position of the element in the array.
valThe element value.

Examples

Expand an array

SELECT posexplode(ARRAY('a', 'c', 'f', 'b'));

Result:

+-----+-----+
| pos | val |
+-----+-----+
| 0   | a   |
| 1   | c   |
| 2   | f   |
| 3   | b   |
+-----+-----+

Related functions

POSEXPLODE is a complex type function. For more information about functions that process ARRAY, MAP, STRUCT, and JSON data, see Complex type functions.