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

# TRANSFORM

> Applies a lambda to array elements.

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

NULL array returns NULL; NULL elements are passed to the lambda. NULL lambda results become NULL elements.

## Syntax

### Scalar

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
transform(array, lambda)
```

## 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.
* U is the result type of the lambda or finish expression: BOOLEAN, TINYINT, SMALLINT, INTEGER, BIGINT, FLOAT, DOUBLE, DECIMAL(p, s), STRING, BINARY, DATE, TIME, TIMESTAMP, ARRAY, MAP or STRUCT.

| Name | Type | Required | Description |
| - | - | - | - |
| array | ARRAY\<T> | Yes | Input elements. Nested elements/fields must satisfy the same element-type restrictions. |
| lambda | FUNCTION(T \[, INT]) -> U | Yes | Receives element and optional zero-based index. Nested elements/fields must satisfy the same element-type restrictions. It is determined when that expression is planned. |

## Returns

* Type: ARRAY\<U>
* Possible values: The lambda results.
* NULL behavior: NULL array returns NULL; NULL elements are passed to the lambda. NULL lambda results become NULL elements.
* Shape: Same number of elements as input.
* Ordering: Input encounter order.

## Properties

| Property | Value |
| - | - |
| Deterministic | Partial (Deterministic when the lambda and its referenced expressions are deterministic.) |
| Supports window usage | No |

## Usage notes

* The optional lambda index is zero-based.
* 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.

## Examples

### Typical behavior

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT transform(ARRAY[1, 2, 3], x -> x + 1) AS "value";
```

| value |
| - |
| \[2,3,4] |

### Transform strings

```sql theme={"theme":{"light":"github-light","dark":"github-dark"}}
SELECT transform(ARRAY('red', 'blue'), x -> upper(x)) AS colors;
```

| colors |
| - |
| \["RED","BLUE"] |

## Limitations

* The same input gives repeatable results only when the supplied lambda does. Avoid random or other changing expressions when you need reproducible results.


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