Numeric Functions
abs
| Syntax | abs(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Absolute value operation |
| Example | abs(-1), returns: 1 |
acos
| Syntax | acos(N) |
|---|---|
| Parameter | Numeric parameter, optional type: number |
| Return Type | Number |
| Description | Returns the arccosine of N, expressed in radians. N must be a value between [-1, 1] |
| Example | acos(0.5), returns: 1.0471975511966 |
asin
| Syntax | asin(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the arcsine of N, expressed in radians. N must be a value between [-1, 1] |
| Example | asin(0.5), returns: 0.523598775598299 |
atan
| Syntax | atan(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the arctangent of N, expressed in radians |
| Example | atan(1), returns: 0.785398163397448 |
atan2
| Syntax | atan2(ARG1, ARG2) |
|---|---|
| Parameter Description | Numeric type parameters, optional type: number |
| Return Value Type | Number |
| Description | Returns the arctangent value of arg1/arg2, expressed in radians |
| Example | atan2(2, 2), returns: 0.785398163397448 |
| Unsupported Data Sources | hive |
ceil
| Syntax | ceil(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Gets the smallest integer value greater than or equal to the specified number |
| Example | ceil(3.2), returns: 4 |
cbrt
| Syntax | cbrt(N) |
|---|---|
| Parameter Description | Numeric type parameter, optional type: number |
| Return Value Type | Number |
| Description | Cube root operation |
| Example | cbrt(8), returns: 2 |
| Unsupported Data Sources | mysql, oracle, sqlserver, db2, impala, tidb, mongodb |
cos
| Syntax | cos(N) |
|---|---|
| Parameter | Numeric parameter, optional type: number |
| Return Type | Number |
| Description | Returns the cosine value of N, where N represents radians |
| Example | cos(pi()/3), returns: 0.5 |
cosh
| Syntax | cosh(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the hyperbolic cosine value of N |
| Example | cosh(1), returns: 1.5430806348152437 |
| Unsupported Data Sources | postgres, greenplum, mysql, sqlserver, hive, tidb, presto, mongodb, redshift |
cot
| Syntax | cot(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the cotangent value of N, where N represents radians, and N cannot be 0 |
| Example | cot(pi()/4), returns: 1 |
degrees
| Syntax | degrees(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Converts radians to degrees, N represents radians |
| Example | degrees(pi()/2), returns: 90 |
| Unsupported Data Source | oracle |
exp
| Syntax | exp(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | e raised to the power of N, where e is the base of the natural logarithm |
| Example | exp(1), returns: 2.171828182845904 |
floor
| Syntax | floor(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Gets the largest integer less than or equal to the specified value |
| Example | floor(3.8), returns: 3 |
greatest
| Syntax | greatest(ARG1, ARG2) |
|---|---|
| Parameters | ARG1: Numeric type parameter, optional type: Number ARG2: Numeric type parameter, optional type: Number |
| Return Type | Number |
| Description | Returns the largest value in the list |
| Example | greatest(5, 10), returns: 10 |
growth_rate
| Syntax | growth_rate(CURRENT, PREVIOUS) |
|---|---|
| Parameter Description | 1. Current value, optional type: number; 2. Previous value, optional type: number |
| Return Type | Number |
| Description | Growth rate |
| Example | growth_rate(120, 100), returns: 0.2 |
ln
| Syntax | ln(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the natural logarithm of N, where the natural logarithm is based on the constant e (2.71828182845904). N must be greater than 0. |
| Example | ln(1), returns: 0 |
log
| Syntax | log(BASE, N) |
|---|---|
| Parameter Description | BASE, optional type: number N, optional type: number |
| Return Type | number |
| Description | Returns 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. |
| Example | log(3, 9), returns: 2 |
| Unsupported Data Sources | db2, redshift |
log10
| Syntax | log10(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the base-10 logarithm, N must be greater than 0 |
| Example | log10(100), returns: 2 |
log2
| Syntax | log2(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the base-2 logarithm, N must be greater than 0 |
| Example | log2(4), returns: 2 |
| Unsupported Data Sources | db2, redshift |
least
| Syntax | least(ARG1, ARG2) |
|---|---|
| Parameter Description | ARG1: Numeric parameter, optional type: number ARG2: Numeric parameter, optional type: number |
| Return Type | Number |
| Description | Returns the smallest value in the list |
| Example | least(5, 10), returns: 5 |
median
| Syntax | median(N) |
|---|---|
| Parameter Description | Numeric type parameter, optional type: number |
| Return Value Type | Number |
| Description | Retrieves the median of the specified numeric column |
| Example | median([1, 2, 3, 4, 5]), returns: 3 |
| Unsupported Data Sources | impala, hive, spark, sqlserver, tidb, mysql |
mod
| Syntax | mod(DIVIDEND, DIVISOR) |
|---|---|
| Parameters | 1. Dividend, optional type: number; 2. Divisor, optional type: number |
| Return Type | Number |
| Description | Modulo operation, parameters can be decimals |
| Example | mod(12.3, 5), returns: 2.3 |
percentile
| Syntax | percentile(N, PERCENT) |
|---|---|
| Parameter Description | 1. Numeric type parameter, optional type: number; 2. Internal parameter, optional type: number |
| Return Value Type | Number |
| Description | Calculates the percentile |
| Example | percentile([1, 2, 3, 4, 5], 0.5), returns: 3 |
| Unsupported Data Sources | impala, hive, spark, sqlserver, tidb, mysql, mongodb, maxcompute |
pi
| Syntax | pi() |
|---|---|
| Parameters | None |
| Return Type | Number |
| Description | π constant, equal to 3.14159265358979 |
| Example | pi(), returns: 3.14159265358979 |
| Unsupported Data Sources | oracle, db2 |
power
| Syntax | power(BASE, EXPONENT) |
|---|---|
| Parameters | 1. Base, optional type: Number; 2. Exponent, optional type: Number |
| Return Type | Number |
| Description | Exponentiation operation |
| Example | power(2, 3), returns: 8 |
radians
| Syntax | radians(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Converts degrees to radians, where N represents degrees |
| Example | radians(180), returns: 3.14159265358979 |
| Unsupported Data Sources | oracle |
rand
| Syntax | rand() |
|---|---|
| Parameters | None |
| Return Type | Number |
| Description | A random value in the range 0.0 <= N < 1.0 |
| Example | rand(), returns: 0.763452189 (example value) |
round
| Syntax | round(N, LITERAL_PRECISION) |
|---|---|
| Parameter Description | 1. Numeric type parameter, optional type: number; 2. Specified precision, optional type: number |
| Return Type | Number |
| Description | Rounds to the specified number of decimal places |
| Example | round(3.14159, 2), returns: 3.14 |
rounddown
| Syntax | rounddown(N, LITERAL_PRECISION) |
|---|---|
| Parameter Description | 1. Numeric type parameter, optional type: number; 2. Specified precision, optional type: number |
| Return Value Type | Number |
| Description | Rounds down to the specified number of decimal places |
| Example | rounddown(3.14159, 2), returns: 3.14 |
roundup
| Syntax | roundup(N, LITERAL_PRECISION) |
|---|---|
| Parameter Description | 1. Numeric type parameter, optional type: number; 2. Specified precision, optional type: number |
| Return Value Type | Number |
| Description | Rounds up to the specified number of decimal places |
| Example | roundup(3.14159, 2), returns: 3.15 |
sign
| Syntax | sign(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Sign function. For example: sign(x), if x > 0, returns 1; if x = 0, returns 0; if x < 0, returns -1 |
| Example | sign(-5), returns: -1 |
sin
| Syntax | sin(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the sine value of N, where N represents radians |
| Example | sin(pi()/6), returns: 0.5 |
sinh
| Syntax | sinh(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the hyperbolic sine of N |
| Example | sinh(1), returns: 0.8686709614860095 |
| Unsupported Data Sources | postgres, greenplum, mysql, sqlserver, hive, tidb, presto, mongodb, redshift |
sqrt
| Syntax | sqrt(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Square root operation |
| Example | sqrt(16), returns: 4 |
tan
| Syntax | tan(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the tangent of N, where N represents radians |
| Example | tan(pi()/4), returns: 1 |
tanh
| Syntax | tanh(N) |
|---|---|
| Parameter | Numeric type parameter, optional type: number |
| Return Type | Number |
| Description | Returns the hyperbolic tangent of N |
| Example | tanh(1), returns: 0.7615941559557649 |
| Unsupported Data Sources | postgres, greenplum, mysql, sqlserver, hive, tidb, presto, mongodb, redshift |