All Products
Search
Document Center

MaxCompute:ARRAY_JOIN

Last Updated:Mar 26, 2026

Concatenates the elements of an array into a string using a specified delimiter.

Syntax

array_join(array<T> <a>, <delimiter>[, <nullreplacement>]) → STRING

Parameters

Parameter Required Type Description
a Yes array\<T\> The array to concatenate. T specifies the element data type. If elements are not of the STRING type, MaxCompute converts them to STRING automatically.
delimiter Yes STRING The string used to separate elements in the result.
nullreplacement No STRING The string used to replace null elements.

Usage notes

  • If the array contains null elements and nullreplacement is set, each null element is replaced with the value of nullreplacement.

  • If the array contains null elements and nullreplacement is not set, null elements are ignored.

Examples

Basic usage — join numeric elements with a comma delimiter:

SELECT array_join(array(10, 20, 20, null, null, 30), ",");
-- 10,20,20,30

With null replacement — replace each null element with the string "null":

SELECT array_join(array(10, 20, 20, null, null, 30), "##", "null");
-- 10##20##20##null##null##30

Related functions

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