OPAL Numeric Functions

Numeric functions act on and/or produce numeric values, for your mathematical calculation needs.

Function

Description

abs

Returns the absolute value of ‘val’.

ceil

Returns ‘val’ rounded up to the given ‘precision’.

count

Count the number of non-null items in the group.

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.

dense_rank

Returns the dense rank within an ordered group of values.

exp

Returns Euler’s number e raised to the given number.

float64_null

Returns a null value of type float64.

floor

Returns ‘val’ rounded down to the given ‘precision’.

haversine_distance_km

Computes the great circle approximate distance between two latitude/longitude coordinates, using the haversine formula.

int64_null

Returns a null value of type int64.

int_div

Returns the integer quotient of the dividend divided by the divisor and truncates the remainder.

ln

Returns natural logarithm of a numeric expression.

log

Returns logarithm of a numeric expression (second argument) with the provided base (first argument).

mod

Returns the remainder when dividend is divided by the divisor.

numeric_null

Returns a null value of type numeric.

percentile_disc

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

pow

Returns a number ‘base’ raised to the specified power ‘exponent’.

prom_quantile

Calculates an approximate percentile value of the distribution in a histogram metric generated by a Prometheus data source.

rank

Returns the rank within an ordered group of values.

round

Returns ‘val’ rounded to the given ‘precision’.

row_number

Return the window index of the row within its groupby, when ordered by the orderby.

sqrt

Returns the square root for a given input and null if input is negative.

uniform

Generates a uniformly-distributed pseudo-random number in the inclusive range [min, max].

width_bucket

Construct equi-width histogram by dividing up the range between min and max with num_buckets buckets, and compute an integer

zipf

Returns a Zipf-distributed integer, for N elements and characteristic exponent s.