Math Function
Abs
Computes the absolute value.
Input Parameters: Column arg0
arg0 (required) - The column for which absolute value to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed absolute value. Throws Application Exception
Use Case:
abs(Column arg0)
Example:
abs(77.76) will return 77.76
Acos
Computes the cosine inverse of the given value; the returned angle is in the range 0.0 through pi.
Input Parameters: Column arg0
arg0 (required) - The column for which cosine inverse to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed cosine inverse in the range 0.0 through pi. Throws Application Exception
Use Case:
acos(Column arg0)
Example:
acos(0.45) will return 1.104031001096478
Asin
Computes the sine inverse of the given value; the returned angle is in the range -pi/2 through pi/2.
Input Parameters: Column arg0
arg0 (required) - The column for which sine inverse to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed sine inverse in the range -pi/2 through pi/2. Throws Application Exception
Use Case:
asin(Column arg0)
Example:
asin(0.45) will return 0.4667653256984187
Atan
Computes the tangent inverse of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which tangent inverse to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed the tangent inverse. Throws Application Exception
Use Case:
atan(Column arg0)
Example:
atan(0.45) will return 0.42285391621948626
Atan2
Computes the angle theta from the conversion of rectangular coordinates (arg0, arg1) to polar coordinates (arg1, theta).
Input Parameters: Column arg0, Column arg1
arg0 (required) - The column for the x rectangular coordinate.
arg1 (required) - The column for the y rectangular coordinate.
Output Type Number Column Configuration Parameters No Returns The computed angle theta. Throws Application Exception
Use Case:
atan2(Column arg0, Column arg1)
Example:
atan2(12, 71.21) will return 1.403849169952035
Bround
Computes the value of the column arg0 rounded to 0 decimal places with HALF_EVEN round mode.
Input Parameters: Column arg0
arg0 (required) - The column for which value rounded to 0 decimal places with HALF_EVEN round mode to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed value Throws Application Exception
Use Case:
bround(Column arg0)
Example:
bround(71.21) will return 71.0
Cbrt
Computes the cube-root of the given column.
Input Parameters: Column arg0
arg0 (required) - The column for which cube-root to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed cube-root. Throws Application Exception
Use Case:
cbrt(Column arg0)
Example:
cbrt(80.89) will return 4.324789202233814
Ceil
Computes the ceiling of the given column.
Input Parameters: Column arg0
arg0 (required) - The column for which ceiling to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed ceiling. Throws Application Exception
Use Case:
ceil(Column arg0)
Example:
ceil(77.76) will return 4.2682720044742055
Conv
Converts a number column from a given base to another.
Input Parameters: Column arg0,Column args1,Column args2
arg0 (required) - A number/String number column
arg1 (required) - Integer column of base from which a number is to be converted
arg2 (required) - Integer column of base to which a number is to be converted.
Output Type String Column Configuration Parameters No Returns The string in the target base. Throws Application Exception
Use Case:
conv(Column arg0,Column args1,Column args2)
Example:
conv(258,10,2) will return 100000010
Cos
Computes the cosine of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which cosine to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed cosine. Throws Application Exception
Use Case:
cos(Column arg0)
Example:
cos(76.56) will return 0.3977126102073901
Cosh
Computes the hyperbolic cosine of the given value.
Input Parameters: Column arg0
arg0 (required) -The column for which hyperbolic cosine to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed hyperbolic cosine. Throws Application Exception
Use Case:
cosh(Column arg0)
Example:
cos(76.56) will return 0.3977126102073901
Degrees
Converts an angle measured in radians to an approximately equivalent angle measured in degrees.
Input Parameters: Column arg0
arg0 (required) -The column for which the equivalent angle measured in degrees to be calculated.
Output Type Number Column Configuration Parameters No Returns The converted angle measured in degrees. Throws Application Exception
Use Case:
degrees(Column arg0)
Example:
degrees(71.21) will return 4080.0324066707394
Exp
Computes the exponential of the given value.
Input Parameters: Column arg0
arg0 (required) -The column for which exponential to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed exponential. Throws Application Exception
Use Case:
exp(Column arg0)
Example:
exp(0.78) will return 2.18147220308578
Expm1
Computes the exponential of the given value minus one.
Input Parameters: Column arg0
arg0 (required) -The column for which exponential minus one to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed value. Throws Application Exception
Use Case:
expm1(Column arg0)
Example:
expm1(0.23) will return 0.2586000151807663
Factorial
Computes the factorial of the given value.
Input Parameters: Column arg0
arg0 (required) -The column for which factorial to be calculated.
Output Type Number Column Configuration Parameters No Returns The computed factorial. Throws Application Exception
Use Case:
factorial(Column arg0)
Example:
factorial(11) will return 39916800
Floor
Computes the floor of the given column.
Input Parameters: Column arg0
arg0 (required) -The column for which floor to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed floor. Throws Application Exception
Use Case:
floor(Column arg0)
Example:
floor(71.21) will return 71
Format_number
Formats numeric column arg0 to a format like ‘#,###,###.##’, rounded to arg1 decimal places, and returns the result as a string column.
Input Parameters: Column arg0, int arg1
arg0 (required) -The column to be formated.
arg1 (required) -The integer specifying the decimal places to be used for rounding.
Output Type Number Column Configuration Parameters No Returns Returns the formatted result as a string column. Throws Application Exception
Use Case:
format_number(Column arg0, int arg1)
Example:
format_number(7120.12, 1) will return 7,120.1
Greatest
It gives the greatest value of the list of values. This function takes at least 2 parameters.
Input Parameters: Column arg0,Column args1,…
arg0 (required) -A column from the schema
arg1 (required) -A column from the schema
Output Type Number Column Configuration Parameters No Returns The greatest column Throws Application Exception
Use Case:
greatest(Column arg0,Column args1,…)
Example:
greatest(258,259) will return 259
Hex
If the argument is an INT, hex returns the number as a STRING in hexadecimal format. Otherwise if the number is a STRING, it converts each character into its hexadecimal representation and returns the resulting STRING.
Input Parameters: Column arg0
arg0 (required) -A int/string column
Output Type String Column Configuration Parameters No Returns A string value. Throws Application Exception
Use Case:
hex(Column arg0)
Example:
hex(258) will return 102
Hypot
Computes sqrt(arg0² + arg1²) without intermediate overflow or underflow.
Input Parameters: Column arg0, Column arg1
arg0 (required) -Will be used while computing sqrt.
arg1 (required) -Will be used while computing sqrt.
Output Type Number Column Configuration Parameters No Returns Returns the computed sqrt(arg0² + arg1²). Throws Application Exception
Use Case:
hypot(Column arg0, Column arg1)
Example:
hypot(71.21, 10.5) will return 71.97995533209642
Least
It gives the least value of the list of values. This function takes at least 2 parameters.
Input Parameters: Column arg0,Column args1,…
arg0 (required) - A column from the schema.
arg1 (required) - A column from the schema.
Output Type Number Column Configuration Parameters No Returns Returns the least column Throws Application Exception
Use Case:
least(Column arg0,Column args1,…)
Example:
least(258,259) will return 259
Log
Computes the natural logarithm of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which natural logarithm to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed natural logarithm. Throws Application Exception
Use Case:
log(Column arg0)
Example:
log(20) will return 2.995732273553991
Log1p
Computes the natural logarithm of the given value plus one.
Input Parameters: Column arg0
arg0 (required) - The column for which natural logarithm plus one to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed natural logarithm plus one. Throws Application Exception
Use Case:
log1p(Column arg0)
Example:
log1p(20) will return 3.044522437723423
Pmod
Computes the positive value of arg0 mod arg1.
Input Parameters: Column arg0, Column arg1
arg0 (required) - The dividend.
arg1 (required) - The divisor.
Output Type Number Column Configuration Parameters No Returns Returns the computed positive value of arg0 mod arg1. Throws Application Exception
Use Case:
pmod(Column arg0, Column arg1)
Example:
pmod(19, 0.78) will return 0.2800007
Pow
Computes the value of the first argument raised to the power of the second argument.
Input Parameters: Column arg0, Column arg1
arg0 (required) - The base.
arg1 (required) - The exponent.
Output Type Number Column Configuration Parameters No Returns Returns the computed value Throws Application Exception
Use Case:
pow(Column arg0, Column arg1)
Example:
pow(20, 2) will return 400
Pow_left_arg_double
Computes the value of the first argument raised to the power of the second argument.
Input Parameters: double arg0, Column arg1
arg0 (required) - The base.
arg1 (required) - The exponent
Output Type Number Column Configuration Parameters No Returns Returns the compute value Throws Application Exception
Use Case:
pow_left_arg_double(double arg0, Column arg1)
Example:
pow_left_arg_double(20, 2) will return 400
Pow_right_arg_double
Computes the value of the first argument raised to the power of the second argument.
Input Parameters: Column arg0, double arg1
arg0 (required) - The base.
arg1 (required) - The exponent
Output Type Column Configuration Parameters No Returns Returns the computed value. Throws Application Exception
Use Case:
pow_right_arg_double(Column arg0, double arg1)
Example:
pow_right_arg_double(20, 2) will return 400
Radians
Converts an angle measured in degrees to an approximately equivalent angle measured in radians.
Input Parameters: Column arg0
arg0 (required) - The column for which equivalent angle measured in radians to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the converted angle measured in radians. Throws Application Exception
Use Case:
radians(Column arg0)
Example:
radians(20) will return 0.3490658503988659
Rand
Generate a random column with independent and identically distributed (i.i.d.) samples from 0.0 to 1.0.
Input Parameters: No input arguments.
Output Type Number Column Configuration Parameters No Returns Returns the generated column. Throws Application Exception
Use Case:
rand()
Example:
rand() will return a new column with independent and identically distributed (i.i.d.) samples from 0.0 to 1.0.
Randn
Generate a column with independent and identically distributed (i.i.d.) samples from the standard normal distribution.
Input Parameters: No input arguments.
Output Type Number Column Configuration Parameters No Returns Returns the generated column. Throws Application Exception
Use Case:
randn()
Example:
randn() will return a new column with independent and identically distributed (i.i.d.) samples from the standard normal distribution.
Rint
Computes the double value that is closest in value to the argument and is equal to a mathematical integer.
Input Parameters: Column arg0
arg0 (required) - The column for which double value to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed last day. Throws Application Exception
Use Case:
rint(Column arg0)
Example:
rint(80.89) will return 81.0
Round
Computes the value of the column arg0 rounded to 0 decimal places.
Input Parameters: Column arg0
arg0 (required) - The column for which value rounded to 0 decimal places to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed value. Throws Application Exception
Use Case:
round(Column arg0)
Example:
round(80.89) will return 81.0
Signum
Computes the signum of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which signum to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed signum. Throws Application Exception
Use Case:
signum(Column arg0)
Example:
signum(20) will return 1.0
Sin
Computes the sine of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which sine to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed sine Throws Application Exception
Use Case:
sin(Column arg0)
Example:
sin(20) will return 0.9129452507276277
Sinh
Computes the hyperbolic sine of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which sine to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed hyperbolic sine. Throws Application Exception
Use Case:
sinh(Column arg0)
Example:
sinh(20) will return 2.4258259770489514E8
Sqrt
Computes the square root of the specified float value.
Input Parameters: Column arg0
arg0 (required) - The column for which square root to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed square root. Throws Application Exception
Use Case:
sqrt(Column arg0)
Example:
Sqrt(20) will return 4.47213595499958
Tan
Computes the tangent of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which tangent to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed tangent Throws Application Exception
Use Case:
tan(Column arg0)
Example:
tan(20) will return 2.237160944224742
Tanh
Computes the hyperbolic tangent of the given value.
Input Parameters: Column arg0
arg0 (required) - The column for which hyperbolic tangent to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the computed hyperbolic tangent. Throws Application Exception
Use Case:
tanh(Column arg0)
Example:
tanh(20) will return 1.0
ToDegrees
Computes the angle measured in radians to an approximately equivalent angle measured in degrees.
Input Parameters: Column arg0
arg0 (required) - The column for which degree to be calculated
Output Type Number Column Configuration Parameters No Returns Returns the angle measured in degrees. Throws Application Exception
Use Case:
toDegrees(Column arg0)
Example:
toDegrees(3.14159) will return 180
ToRadians
Computes the angle measured in degrees to an approximately equivalent angle measured in radians.
Input Parameters: Column arg0
arg0 (required) - A column for which radians to be calculated.
Output Type Number Column Configuration Parameters No Returns Returns the angle measured in radians. Throws Application Exception
Use Case:
toRadians(Column arg0)
Example:
toRadians(180) will return 3.14159
If you have any feedback on Gathr documentation, please email us!