Beam ZetaSQL mathematical functions
This page documents ZetaSQL scalar functions supported by Beam ZetaSQL.
All mathematical functions return NULL
if any of the input parameters is NULL
.
Operator syntax | Description |
---|---|
MOD(X, Y) | Returns the remainder of the division of X by Y |
CEIL(X) | Returns the smallest integral value (with FLOAT64 type) that is not less than X |
CEILING(X) | Synonym of CEIL(X) |
FLOOR(X) | Returns the largest integral value (with FLOAT64 type) that is not greater than X |
MOD
MOD(X, Y)
Description
Modulo function: returns the remainder of the division of X by Y. Returned value has the same sign as X.
CEIL
CEIL(X)
Description
Returns the smallest integral value (with FLOAT64 type) that is not less than X.
CEILING
CEILING(X)
Description
Synonym of CEIL(X)
FLOOR
FLOOR(X)
Description
Returns the largest integral value (with FLOAT64 type) that is not greater than X.
Example rounding function behavior
Example behavior of Cloud Dataflow SQL rounding functions:
Input "X" | CEIL(X) | FLOOR(X) |
---|---|---|
2.0 | 2.0 | 2.0 |
2.3 | 3.0 | 2.0 |
2.8 | 3.0 | 2.0 |
2.5 | 3.0 | 2.0 |
-2.3 | -2.0 | -3.0 |
-2.8 | -2.0 | -3.0 |
-2.5 | -2.0 | -3.0 |
0 | 0 | 0 |