All Products
Search
Document Center

MaxCompute:TRANSFORM

Last Updated:Mar 26, 2026

Applies a function to each element of an array and returns a new array of results.

Quick example: select transform(array(1, 2, 3), x -> x + 1) returns [2, 3, 4].

Syntax

array<R> transform(array<T> <a>, function<T, R> <func>)

Parameters

ParameterRequiredDescription
aYesThe input array. T in array<T> is the element data type, which can be any supported data type.
funcYesA built-in function, user-defined function (UDF), or expression applied to each element of a. The input type must match the element type T of a. R is the return type, which determines the element type of the output array.

Return value

An array of type array<R>, where R is the return type of func.

Examples

Basic numeric transformation

-- Returns [2, 3, 4]
select transform(array(1, 2, 3), x -> x + 1);
Note

The -> operator is the Lambda arrow operator. For syntax details and advanced usage, see Lambda functions.

Related functions

TRANSFORM is a complex type function. For other functions that process ARRAY, MAP, STRUCT, and JSON data, see Complex type functions.