The scalar math functions Client.Local evaluates in SQL expressions,
wherever an expression stands (WHERE, the select list, ORDER BY, an
aggregate's argument), as InfluxDB 3 does (verified against Core):
abs(x)— the magnitude, in the argument's typeround(x),round(x, n)— half away from zero (round(-2.5)is-3.0), tondecimal places (negativenrounds left of the point:round(1234.5678, -2)is1200.0); always a floatfloor(x),ceil(x)— always a float
A null argument makes the result null. Names are case-insensitive.
The engine checks the arguments' types when it plans the query, so a
wrong one fails the query even when no row would reach the call
(check/3). The message depends on where the call stands: in WHERE
it carries the type_coercion prefix, in ORDER BY it is cut after its
first sentence, and in the select list it has neither. floor and ceil
with a second argument are the engine's 405.
Summary
Functions
Evaluates a call the planner has accepted (check/3), its arguments
already evaluated: numbers, or nil, which makes the result nil.
The engine's planning error for a call, given its arguments' Arrow types
(nil where unknown, which is never refused), or :ok.
The function a name (any case) calls, or nil for any other name.
The Arrow type an expression has, given the columns' types, or nil
when it cannot be known.
Types
Functions
Evaluates a call the planner has accepted (check/3), its arguments
already evaluated: numbers, or nil, which makes the result nil.
The engine's planning error for a call, given its arguments' Arrow types
(nil where unknown, which is never refused), or :ok.
The function a name (any case) calls, or nil for any other name.
@spec type_of(InfluxElixir.Client.Local.SQLParser.expr(), %{ required(binary()) => binary() }) :: binary() | nil
The Arrow type an expression has, given the columns' types, or nil
when it cannot be known.