ZIP

Merges the given arrays, element-wise, into a single array of rows.

Syntax

ZIP(ARRAY1, ARRAY2 [, ...]) 

Arguments

ARRAY

Type: array

A array of values of any type.

Returns

Type: array

The given arrays merged element-wise into a single array of rows.

The M-th element of the N-th argument will be the N-th field of the M-th output element. If the arguments have an uneven length, missing values are filled with NULL.


Examples

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 
    ZIP(ARRAY[1, 2], ARRAY['1b', null::string, '3b']) AS zip_example1,
    ZIP(ARRAY['a', 'b', 'c'], ARRAY[1, 2], ARRAY[false, true, false]) AS zip_example2
   FROM default_glue_catalog.upsolver_samples.orders_raw_data 
   WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
   LIMIT 1;

Query result

Last updated