OPAL Time Functions

Time functions provide conversion to and from various time and date formats.

Function

Description

abs

Returns the absolute value of ‘val’.

avg

Calculate the arithmetic average of the input expression across the group, or of the scalar arguments if more than one.

bin_end_time

Returns the end time of the current bin (exclusive).

bin_size

Returns the size of the time bin that’s being aggregated.

bin_start_time

Returns the start time of the current bin (inclusive).

delta

Calculates the value difference of the argument in each time bin for each group.

delta_monotonic

Calculates the amount of difference in a column in each time bin for each group.

deriv

Calculate the average per-second derivative of the argument across the group.

duration

Convert one argument as a number of nanoseconds or a timestamp, or two arguments as start or stop timestamps, to a duration.

duration_hr

The input is a number representing a number of hours, the output is that quantity as type duration.

duration_min

The input is a number representing a number of minutes, the output is that quantity as type duration.

duration_ms

The input is a number representing a number of milliseconds, the output is that quantity as type duration.

duration_null

Returns a null value of type duration.

duration_sec

The input is a number representing a number of seconds, the output is that quantity as type duration.

format_time

Format a timestamp column according to the specified format string.

from_milliseconds

Given a numeric value representing milliseconds since epoch, return a timestamp of that point in time.

from_nanoseconds

Given a numeric value representing nanoseconds since epoch, return a timestamp of that point in time.

from_seconds

Given a numeric value representing seconds since epoch, return a timestamp of that point in time.

median

Return the fast approximate median value of one column.

median_exact

Return the exact median value of one column.

now

Returns the current time for which the query is executed as timestamp.

parse_duration

Given a string describing the duration between two points in time, convert it to a duration.

parse_isotime

Parse an ISO8601 (YYYY-MM-DDTHH:MM:SSZ) formatted string as a timestamp.

parse_timestamp

Parse a string value, whose format is specified by the format argument, as a timestamp.

percentile

Returns an approximated value for the specified percentile of the input expression across the group.

percentile_cont

Assuming a continuous distribution, return the value for the specified percentile of the input expression across the group.

percentile_disc

Assuming a discrete distribution, return the value for the specified percentile of the input expression across the group.

query_end_time

Returns the latest time of the query time window.

query_start_time

Returns the earliest time of the query time window.

rate

Calculate the average per-second rate of the argument across the group.

row_end_time

Returns the value of the “Valid To” column, or null if the verb input dataset has no “Valid To” column.

row_timestamp

Returns the value of the timestamp column for each row.

stddev

Calculate the standard deviation across the group.

sum

Calculate the sum of the argument across the group, or of the scalar arguments if more than one.

tdigest_agg

Generate a single t-digest state out of an arbitrary number of numeric values.

timestamp_null

Returns a null value of type timestamp.

to_days

Convert a duration to a number of days.

to_hours

Convert a duration to a number of hours.

to_milliseconds

Convert a duration to a number of milliseconds.

to_minutes

Convert a duration to a number of minutes.

to_nanoseconds

Convert a duration to a number of nanoseconds.

to_seconds

Convert a duration to a number of seconds.

to_weeks

Convert a duration to a number of weeks.

valid_for

Specify the validity period for each event for some verbs