> ## Documentation Index
> Fetch the complete documentation index at: https://docs.e6data.com/llms.txt
> Use this file to discover all available pages before exploring further.

# EXPLODE

> Expands each ARRAY element or MAP entry into a row.

<div className="e6-meta"><span className="e6-eyebrow e6-eyebrow--quiet">Table function</span></div>

NULL input emits no rows; NULL array elements emit NULL values.

## Syntax

### Table

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
explode(collection)
```

## 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.

| Name | Type | Required | Description |
| - | - | - | - |
| collection | ARRAY\<T> or MAP\<K,V> | Yes | Collection to expand. Nested elements/fields must satisfy the same element-type restrictions. A lookup key must have the map's key type after conversion. Map keys must be non-NULL. Nested values retain their declared element/field types. |

## Returns

* Type: TABLE\<col:T> or TABLE\<key:K,value:V>
* NULL behavior: NULL input emits no rows; NULL array elements emit NULL values.
* Empty input: No rows 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

| Property | Value |
| - | - |
| Deterministic | Yes |
| Supports window usage | No |
| Exact result | Yes |

## 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

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT "value" FROM TABLE(explode(ARRAY(10, 20))) AS t("value") ORDER BY "value";
```

| value |
| - |
| 10 |
| 20 |

### Expand an array of strings

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT "value" FROM TABLE(explode(ARRAY('red', 'blue'))) AS t("value") ORDER BY "value";
```

| value |
| - |
| blue |
| red |

## Limitations

* Exactly one ARRAY/MAP argument is required.

## Related functions

* [explode\_outer](/query/sql/functions/table/explode_outer)
* [posexplode](/query/sql/functions/table/posexplode)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.