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 syntaxDescription
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.02.02.0
2.33.02.0
2.83.02.0
2.53.02.0
-2.3-2.0-3.0
-2.8-2.0-3.0
-2.5-2.0-3.0
000