FIRST

Returns the first input value to arrive for each group.

Syntax

FIRST(X)

Arguments

X

Type: any

The value to return.

Returns

Type: same as input

Returns first value of X that arrived for each group.


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 
        LOWER(ordertype) as ordertype,
        FIRST(customer.email) as first_customer
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE $commit_time BETWEEN run_start_time() - PARSE_DURATION('1d') 
        AND run_end_time()
    GROUP BY 1
    LIMIT 2;

Query result

ordertypefirst_customer

pickup

Pamela.Nguyen@aol.com

shipping

Patricia.Johnson@facebook.com

Last updated