JOIN_ARRAYS

Joins any number of arrays by index using a MessageFormat pattern.

Syntax

JOIN_ARRAYS(formatString, inputs1[, inputs2, ..., inputsN])

Arguments

Name
Type
Description
Default Value

formatString

string

The format string where {n} prints the n'th input. For example, the pattern '{0}.{0}.{1}' on the inputs 'a' and 'b' will result in the string 'a.a.b'

null

inputs#

any

Returns

Returns a string value.


Examples

formatString
inputs1
inputs2
inputs3
Output

'{0} {1} is {2} years old'

array['John', 'Jane']

array['Smith', 'Johnson']

array[35, 32]

[John Smith is 35 years old, Jane Johnson is 32 years old]

'{0}:{1}'

array['red', 'green', 'blue', 'luminosity']

array[255, 255, 0]

[red:255, green:255, blue:0, luminosity:]

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 formatString, inputs1[], inputs2[], inputs3[],
  JOIN_ARRAYS('{0} {1} is {2} years old', inputs1[], inputs2[], inputs3[]) AS Output
  FROM default_glue_catalog.upsolver_samples.orders_raw_data
    LET formatString = '{0} {1} is {2} years old',
        inputs1 = array['John', 'Jane'],
        inputs2 = array['Smith', 'Johnson'],
        inputs3 = array[35, 32]
    WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
    LIMIT 1;

Query result

formatString
inputs1[]
inputs2[]
inputs3[]
Output

'{0} {1} is {2} years old'

array['John', 'Jane']

array['Smith', 'Johnson']

array[35, 32]

[John Smith is 35 years old, Jane Johnson is 32 years old]

Last updated