ARRAY_JOIN

Concatenates the elements of the given array using the specified delimiter.

Syntax

ARRAY_JOIN(X, DELIMITER)

Arguments

X

Type: array

An array of any value type.

DELIMITER

Type: string

The delimiter used to join the values within the array.

Returns

Type: string

The values of the array X joined with DELIMITER.


Examples

XDELIMITEROutput

[a, b, c]

,

a,b,c

[5.5]

,

5.5

[hello, NULL, world]

hello world

[brave, NULL, world]

new

brave new world

[3,6,1,2]

,

3,6,1,2

[5.5]

NULL

NULL

Transformation job example

SQL

CREATE JOB function_operator_example
    ADD_MISSING_COLUMNS = true	
AS INSERT INTO default_glue_catalog.upsolver_samples.orders_transformed_data 
        MAP_COLUMNS_BY_NAME
    SELECT 
        ARRAY_JOIN(ARRAY['hello', null::string ,'world'], ' ') AS join_example
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
    GROUP BY shippinginfo_address_state
    LIMIT 1;

Query result

join_example

hello world

Last updated