All Products
Search
Document Center

MaxCompute:ARRAY_JOIN

Last Updated:Jul 26, 2023

Concatenates the elements in Array a by using a delimiter. If the array contains a null element, use nullreplacement to specify the string that you want to use to replace the null element in the results. If you do not configure nullreplacement, the null element is ignored.

Syntax

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

Parameters

  • a: required. This parameter specifies an array. T in array<T> specifies the data type of the elements in the array.

    Note

    If the elements in the array are not of the STRING type, MaxCompute converts the data type of the elements into STRING.

  • delimiter: required. A value of the STRING type. This parameter specifies the string that is used to separate the concatenated elements in Array a.

  • nullreplacement: optional. This parameter specifies the string that is used to replace null elements.

Return value

A value of the STRING type is returned.

Examples

-- The return value is 10,20,20,30. 
select array_join(array(10, 20, 20, null, null, 30), ",");
-- The return value is 10##20##20##null##null##30. 
select array_join(array(10, 20, 20, null, null, 30), "##", "null");

Related functions

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