EXTRACT

Extracts a unit of time as a field from the given timestamp.

Syntax

EXTRACT(FIELD FROM X)

Arguments

FIELD

Type: identifier

The unit of time to extract.

The following fields are supported:

X

Type: timestamp

The time to extract FIELD from.

Returns

Type: bigint

The FIELD extracted from X.


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 
        "$event_timestamp",
        EXTRACT(DAY_OF_YEAR FROM "$event_timestamp") AS event_doy
    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