Skip to content

Numeric Functions

Mathematical Functions

The following mathematical functions are available in ODAS.

Function Description
abs() Returns the absolute value of a given argument
acos() Returns the arc cosine
asin() Returns the arc sine
atan() Returns the arc tangent
atan2() Returns the arc tangent of two arguments
ceil() Returns the smallest integer value not less than the argument
ceiling() Same as ceil().
conv() Converts numbers between different number bases
cos() Returns the cosine
cosh() Returns the hyperbolic cosine
cot() Returns the cotangent
dceil() Same as ceil()
degrees() Converts a radians number to degrees
dexp() Same as exp()
dfloor() Same as floor()
dlog1() Same as ln()
dlog10() Same as log10()
dpow() Same as pow()
dround() Same as round()
dsqrt() Same as sqrt()
dtrunc() Same as truncate()
e() Returns the value of constant e (same as exp(1))
exp() Raises e to the power of given argument
factorial() Returns factorial of argument
floor() Returns the largest integer value not greater than the argument
fmod() Returns the modulus of two floating point numbers
fpow() Same as pow() for floating point numbers
least() Returns the smallest value from a given list of values
ln() Returns the natural logarithm of the argument
log() Returns the natural logarithm of the first argument
log10() Returns the base-10 logarithm of the argument
log2() Returns the base-2 logarithm of the argument
mod() Returns the modulus (that is, remainder) of two numbers
negative() Returns the negative of the argument
pi() Returns the value of the constant pi
pmod() Returns the positive modulus of two numbers
positive() Returns the positive of the argument
pow() Returns the first argument raised to the power of the second argument
precision() Returns the decimal precision needed for a given argument
quotient() Returns the first argument divided by the second argument, discarding any fractional part
radians() Converts the argument value from degrees to radians
rand() Returns a random number, allows to specify an optional seed value
random() Same as rand()
round() Returns a given floating point value rounded to the nearest integer value
scale() Returns the decimal scale needed for a given argument
sign() Returns -1 for negative numbers, else returns 1
sin() Returns the sine of the argument
sinh() Returns the hyperbolic sine of the argument
sqrt() Returns the square root of the argument
tan() Returns the tangent of the argument
tanh() Returns the hyperbolic tangent of the argument
truncate() Removes the specified (or all) fractional digits from a given value

While these functions are available, Okera does not recommend that you use them for computational workloads, such as analytics or insights, directly within Okera, that is, inside a VIEW or as part of a query in the Okera Portal UI Workspace tab.

Instead, downstream clients, such as compute and/or SQL engines, should be tasked to perform such operations. As an example, the Presto endpoint provided by ODAS clusters can be used to perform these types of queries.

Analytical Functions

The following analytical functions are available in ODAS. See Apache MADlib for details.

Function Description
madlib_decode_vector() Decodes a MADlib vector from a string
madlib_encode_vector() Encodes a MADlib vector into a string
madlib_print_vector() Returns the content of a MADlib vector as a string
madlib_vector() Returns a MADlib vector based on the given arguments
madlib_vector_get() Returns part of a MAlib vector