Skip to content

Numeric Functions

abs

Syntaxabs(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionAbsolute value operation
Exampleabs(-1), returns: 1

acos

Syntaxacos(N)
ParameterNumeric parameter, optional type: number
Return TypeNumber
DescriptionReturns the arccosine of N, expressed in radians. N must be a value between [-1, 1]
Exampleacos(0.5), returns: 1.0471975511966

asin

Syntaxasin(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the arcsine of N, expressed in radians. N must be a value between [-1, 1]
Exampleasin(0.5), returns: 0.523598775598299

atan

Syntaxatan(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the arctangent of N, expressed in radians
Exampleatan(1), returns: 0.785398163397448

atan2

Syntaxatan2(ARG1, ARG2)
Parameter DescriptionNumeric type parameters, optional type: number
Return Value TypeNumber
DescriptionReturns the arctangent value of arg1/arg2, expressed in radians
Exampleatan2(2, 2), returns: 0.785398163397448
Unsupported Data Sourceshive

ceil

Syntaxceil(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionGets the smallest integer value greater than or equal to the specified number
Exampleceil(3.2), returns: 4

cbrt

Syntaxcbrt(N)
Parameter DescriptionNumeric type parameter, optional type: number
Return Value TypeNumber
DescriptionCube root operation
Examplecbrt(8), returns: 2
Unsupported Data Sourcesmysql, oracle, sqlserver, db2, impala, tidb, mongodb

cos

Syntaxcos(N)
ParameterNumeric parameter, optional type: number
Return TypeNumber
DescriptionReturns the cosine value of N, where N represents radians
Examplecos(pi()/3), returns: 0.5

cosh

Syntaxcosh(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the hyperbolic cosine value of N
Examplecosh(1), returns: 1.5430806348152437
Unsupported Data Sourcespostgres, greenplum, mysql, sqlserver, hive, tidb, presto, mongodb, redshift

cot

Syntaxcot(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the cotangent value of N, where N represents radians, and N cannot be 0
Examplecot(pi()/4), returns: 1

degrees

Syntaxdegrees(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionConverts radians to degrees, N represents radians
Exampledegrees(pi()/2), returns: 90
Unsupported Data Sourceoracle

exp

Syntaxexp(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
Descriptione raised to the power of N, where e is the base of the natural logarithm
Exampleexp(1), returns: 2.171828182845904

floor

Syntaxfloor(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionGets the largest integer less than or equal to the specified value
Examplefloor(3.8), returns: 3

greatest

Syntaxgreatest(ARG1, ARG2)
ParametersARG1: Numeric type parameter, optional type: Number
ARG2: Numeric type parameter, optional type: Number
Return TypeNumber
DescriptionReturns the largest value in the list
Examplegreatest(5, 10), returns: 10

growth_rate

Syntaxgrowth_rate(CURRENT, PREVIOUS)
Parameter Description1. Current value, optional type: number;
2. Previous value, optional type: number
Return TypeNumber
DescriptionGrowth rate
Examplegrowth_rate(120, 100), returns: 0.2

ln

Syntaxln(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the natural logarithm of N, where the natural logarithm is based on the constant e (2.71828182845904). N must be greater than 0.
Exampleln(1), returns: 0

log

Syntaxlog(BASE, N)
Parameter DescriptionBASE, optional type: number
N, optional type: number
Return Typenumber
DescriptionReturns the logarithm of N with BASE as the base. BASE must be greater than 0 and cannot be 1, N must be greater than 0.
Examplelog(3, 9), returns: 2
Unsupported Data Sourcesdb2, redshift

log10

Syntaxlog10(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the base-10 logarithm, N must be greater than 0
Examplelog10(100), returns: 2

log2

Syntaxlog2(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the base-2 logarithm, N must be greater than 0
Examplelog2(4), returns: 2
Unsupported Data Sourcesdb2, redshift

least

Syntaxleast(ARG1, ARG2)
Parameter DescriptionARG1: Numeric parameter, optional type: number
ARG2: Numeric parameter, optional type: number
Return TypeNumber
DescriptionReturns the smallest value in the list
Exampleleast(5, 10), returns: 5

median

Syntaxmedian(N)
Parameter DescriptionNumeric type parameter, optional type: number
Return Value TypeNumber
DescriptionRetrieves the median of the specified numeric column
Examplemedian([1, 2, 3, 4, 5]), returns: 3
Unsupported Data Sourcesimpala, hive, spark, sqlserver, tidb, mysql

mod

Syntaxmod(DIVIDEND, DIVISOR)
Parameters1. Dividend, optional type: number; 2. Divisor, optional type: number
Return TypeNumber
DescriptionModulo operation, parameters can be decimals
Examplemod(12.3, 5), returns: 2.3

percentile

Syntaxpercentile(N, PERCENT)
Parameter Description1. Numeric type parameter, optional type: number;
2. Internal parameter, optional type: number
Return Value TypeNumber
DescriptionCalculates the percentile
Examplepercentile([1, 2, 3, 4, 5], 0.5), returns: 3
Unsupported Data Sourcesimpala, hive, spark, sqlserver, tidb, mysql, mongodb, maxcompute

pi

Syntaxpi()
ParametersNone
Return TypeNumber
Descriptionπ constant, equal to 3.14159265358979
Examplepi(), returns: 3.14159265358979
Unsupported Data Sourcesoracle, db2

power

Syntaxpower(BASE, EXPONENT)
Parameters1. Base, optional type: Number;
2. Exponent, optional type: Number
Return TypeNumber
DescriptionExponentiation operation
Examplepower(2, 3), returns: 8

radians

Syntaxradians(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionConverts degrees to radians, where N represents degrees
Exampleradians(180), returns: 3.14159265358979
Unsupported Data Sourcesoracle

rand

Syntaxrand()
ParametersNone
Return TypeNumber
DescriptionA random value in the range 0.0 <= N < 1.0
Examplerand(), returns: 0.763452189 (example value)

round

Syntaxround(N, LITERAL_PRECISION)
Parameter Description1. Numeric type parameter, optional type: number;
2. Specified precision, optional type: number
Return TypeNumber
DescriptionRounds to the specified number of decimal places
Exampleround(3.14159, 2), returns: 3.14

rounddown

Syntaxrounddown(N, LITERAL_PRECISION)
Parameter Description1. Numeric type parameter, optional type: number;
2. Specified precision, optional type: number
Return Value TypeNumber
DescriptionRounds down to the specified number of decimal places
Examplerounddown(3.14159, 2), returns: 3.14

roundup

Syntaxroundup(N, LITERAL_PRECISION)
Parameter Description1. Numeric type parameter, optional type: number;
2. Specified precision, optional type: number
Return Value TypeNumber
DescriptionRounds up to the specified number of decimal places
Exampleroundup(3.14159, 2), returns: 3.15

sign

Syntaxsign(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionSign function. For example: sign(x), if x > 0, returns 1; if x = 0, returns 0; if x < 0, returns -1
Examplesign(-5), returns: -1

sin

Syntaxsin(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the sine value of N, where N represents radians
Examplesin(pi()/6), returns: 0.5

sinh

Syntaxsinh(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the hyperbolic sine of N
Examplesinh(1), returns: 0.8686709614860095
Unsupported Data Sourcespostgres, greenplum, mysql, sqlserver, hive, tidb, presto, mongodb, redshift

sqrt

Syntaxsqrt(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionSquare root operation
Examplesqrt(16), returns: 4

tan

Syntaxtan(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the tangent of N, where N represents radians
Exampletan(pi()/4), returns: 1

tanh

Syntaxtanh(N)
ParameterNumeric type parameter, optional type: number
Return TypeNumber
DescriptionReturns the hyperbolic tangent of N
Exampletanh(1), returns: 0.7615941559557649
Unsupported Data Sourcespostgres, greenplum, mysql, sqlserver, hive, tidb, presto, mongodb, redshift

User Manual for Hengshi Analysis Platform