Skip to main content

Numeric Functions


Numeric functions perform mathematical, rounding, or computational operations on scalar numeric values.
They are used to calculate or transform values across filters, projections, and aggregations.

Usage

Each numeric function is defined using the $fn key and takes one or more inputs through the $operands array.
Operands can be scalar values, column references, or any other valid expression.

  • All inputs must be numeric types such as integer, float, or decimal.
  • Functions like modulo, bitwise, or factorial require integer inputs.
  • When combining different numeric types, explicit casting may be necessary using $cast or $shortCast.
  • If an operand has an invalid type (e.g. a string), an error is raised.

$abs

Added in: indicate.dsl.dql@1.0.0
Returns the absolute value of a numeric expression.

{
"$fn": "abs",
"$operand": { object (Expression) }
}
Example:
{
"$unary": {
"$fn": "abs",
"$operand": { "$scalar": -17.4 }
}
}

$ceil

Added in: indicate.dsl.dql@1.0.0
Rounds a number up to the nearest integer.

{
"$fn": "ceil",
"$operand": { object (Expression) }
}
Example:
{
"$unary": {
"$fn": "ceil",
"$operand": { "$scalar": 4.3 }
}
}

$floor

Added in: indicate.dsl.dql@1.0.0
Rounds a number down to the nearest integer.

{
"$fn": "floor",
"$operand": { object (Expression) }
}
Example:
{
"$unary": {
"$fn": "floor",
"$operand": { "$scalar": 4.8 }
}
}

$round

Added in: indicate.dsl.dql@1.0.0
Rounds a number to the nearest integer.

{
"$fn": "round",
"$operand": { object (Expression) }
}
Example:
{
"$unary": {
"$fn": "round",
"$operand": { "$scalar": 5.6 }
}
}

$sqrt

Added in: indicate.dsl.dql@1.0.0
Returns the square root of a numeric value.

{
"$fn": "sqrt",
"$operand": { object (Expression) }
}

Example:
{
"$unary": {
"$fn": "sqrt",
"$operand": { "$scalar": 16 }
}
}

$exp

Added in: indicate.dsl.dql@1.0.0
Returns the exponential value of a number (e^x).

{
"$fn": "exp",
"$operand": { object (Expression) }
}
Example:
{
"$unary": {
"$fn": "exp",
"$operand": { "$scalar": 2 }
}
}

$pow

Added in: indicate.dsl.dql@1.0.0
Raises a number to the power of another number.

{
"$fn": "pow",
"$operands": [
{ object (Expression) },
{ object (Expression) }
]
}
Example:
{
"$fn": "pow",
"$operands": [
{ "$scalar": 2 },
{ "$scalar": 4 }
]
}

$mod

Added in: indicate.dsl.dql@1.0.0
Computes the remainder of a division operation.

{
"$fn": "mod",
"$operands": [
{ object (Expression) },
{ object (Expression) }
]
}
Example:
{
"$fn": "mod",
"$operands": [
{ "$scalar": 17 },
{ "$scalar": 5 }
]
}