Expressions#

col(name)

Creates an expression which refers to a table's column.

lit(v[, data_type])

Creates a SQL literal.

range_(start, end)

Indicates a range from 'start' to 'end', which can be used in columns selection.

and_(predicate0, predicate1, *predicates)

Boolean AND in three-valued logic.

or_(predicate0, predicate1, *predicates)

Boolean OR in three-valued logic.

not_(expression)

Inverts a given boolean expression.

current_database()

Returns the current database

current_date()

Returns the current SQL date in local time zone.

current_time()

Returns the current SQL time in local time zone.

current_timestamp()

Returns the current SQL timestamp in local time zone, the return type of this expression is TIMESTAMP_LTZ.

current_watermark(rowtimeAttribute)

Returns the current watermark for the given rowtime attribute, or NULL if no common watermark of all upstream operations is available at the current operation in the pipeline.

local_time()

Returns the current SQL time in local time zone.

local_timestamp()

Returns the current SQL timestamp in local time zone, the return type of this expression s TIMESTAMP.

to_date(date_str[, format])

Converts the date string with the given format (by default 'yyyy-MM-dd') to a date.

to_timestamp(timestamp_str[, format])

Converts the date time string with the given format (by default: 'yyyy-MM-dd HH:mm:ss') under the 'UTC+0' time zone to a timestamp.

to_timestamp_ltz(numeric_epoch_time, precision)

Converts a numeric type epoch time to TIMESTAMP_LTZ.

temporal_overlaps(left_time_point, ...)

Determines whether two anchored time intervals overlap.

date_format(timestamp, format)

Formats a timestamp as a string using a specified format.

timestamp_diff(time_point_unit, time_point1, ...)

Returns the (signed) number of TimePointUnit between time_point1 and time_point2.

convert_tz(date_str, tz_from, tz_to)

Converts a datetime string date_str (with default ISO timestamp format 'yyyy-MM-dd HH:mm:ss') from time zone tz_from to time zone tz_to.

from_unixtime(unixtime[, format])

Converts unix timestamp (seconds since '1970-01-01 00:00:00' UTC) to datetime string the given format.

unix_timestamp([date_str, format])

Gets the current unix timestamp in seconds if no arguments are not specified.

array(head, *tail)

Creates an array of literals.

row(head, *tail)

Creates a row of expressions.

map_(key, value, *tail)

Creates a map of expressions.

row_interval(rows)

Creates an interval of rows.

pi()

Returns a value that is closer than any other value to pi.

e()

Returns a value that is closer than any other value to e.

rand([seed])

Returns a pseudorandom double value between 0.0 (inclusive) and 1.0 (exclusive) with a initial seed if specified.

rand_integer(bound[, seed])

Returns a pseudorandom integer value between 0 (inclusive) and the specified value (exclusive) with a initial seed if specified.

atan2(y, x)

Calculates the arc tangent of a given coordinate.

negative(v)

Returns negative numeric.

concat(first, *others)

Returns the string that results from concatenating the arguments.

concat_ws(separator, first, *others)

Returns the string that results from concatenating the arguments and separator.

uuid()

Returns an UUID (Universally Unique Identifier) string (e.g., "3d3c68f7-f608-473f-b60c-b0c44ad4cc4e") according to RFC 4122 type 4 (pseudo randomly generated) UUID.

null_of(data_type)

Returns a null literal value of a given data type.

log(v[, base])

If base is specified, calculates the logarithm of the given value to the given base.

source_watermark()

Source watermark declaration for schema.

if_then_else(condition, if_true, if_false)

Ternary conditional operator that decides which of two other expressions should be evaluated based on a evaluated boolean condition.

coalesce(*args)

Returns the first argument that is not NULL.

with_columns(head, *tails)

Creates an expression that selects a range of columns.

without_columns(head, *tails)

Creates an expression that selects all columns except for the given range of columns.

json_string(value)

Serializes a value into JSON.

json_object([on_null])

Builds a JSON object string from a list of key-value pairs.

json_object_agg(on_null, key_expr, value_expr)

Builds a JSON object string by aggregating key-value expressions into a single JSON object.

json_array([on_null])

Builds a JSON array string from a list of values.

json_array_agg(on_null, item_expr)

Builds a JSON object string by aggregating items into an array.

call(f, *args)

The first parameter f could be a str or a Python user-defined function.

call_sql(sql_expression)

A call to a SQL expression.