SPLIT

Splits a string by the given delimiter.

Syntax

SPLIT(STRING, DELIMITER)

Arguments

STRING

Type: string

A sequence of characters to split.

DELIMITER

Type: string

A sequence of one or more characters for specifying the boundary between separate, independent regions in plain text.

Returns

Type: array

Splits STRING on DELIMITER and returns an array.


Examples

STRINGDELIMITEROutput

abc

b

['a','c']

abc

d

['abc']

abcdefg

cde

['ab','fb']

1234567

345

['12','67']

1234567

0

['1234567']

1234567

null

null

null

0

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 
        customer_email,
        SPLIT(customer_email, '@') AS split_email
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
    LIMIT 3;

Query result

customer_emailsplit_email

Janice.Ramos@verizon.net

['Janice.Ramos','verizon.net']

John.Williams@hotmail.com

['John.Williams','hotmail.com']

Maria.Robertsh@verizon.net

['Maria.Robertsh','verizon.net']

Last updated