RAND

Returns a pseudo-random value in the range 0.0 <= x < 1.0.

This is an alias for the RANDOM function.

Syntax

RAND()

Returns

type: double

A pseudo-random value in the range 0.0 <= x < 1.0

The value will not change between different runs of the same task, i.e. if the result of this function makes the task fail, it will consistently fail.


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 RAND() as random_value
    FROM default_glue_catalog.upsolver_samples.orders_raw_data 
    WHERE $commit_time BETWEEN run_start_time() AND run_end_time()
    LIMIT 5;

Query result

random_value

0.7221127479457028

0.2188878339486462

0.2127962883398693

0.12963758700859804

0.52354605630098234

Last updated