ARRAY_MIN

Returns the minimum value of the given input array.

Syntax

ARRAY_MIN(X)

Arguments

X

Type: array

An array of any comparable value type.

Returns

Type: same as input

The minimum value of X.

Examples

XOutput

[1,2,3,1,2,3]

1

[1,1,1,1,1,1,1]

1

[0,1,0,1,0,1]

0

[NULL,1,0,1,0,1]

NULL

[a,b,a,c,c,c]

a

[NULL]

NULL

[a,b,c,z]

a

[true, false]

false

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_MIN(ARRAY[4, 5, 0, 9, -3, 2]) AS min_example1,
        ARRAY_MIN(ARRAY['', 'a', 'b', 'c', 'z']) AS min_example2
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE time_filter()
    GROUP BY shippinginfo_address_state
    LIMIT 1;

Query result

min_example1min_example2

-3

''

Last updated