# Catalog

# Fenl Catalog v0.1.0-dev

**add**

**add**

`add(a: number, b: number) -> number`

Operator: a + b

Returns the sum of two numbers.

- math

**add_time**

**add_time**

`add_time(delta: timedelta, time: timestamp_ns) -> timestamp_ns`

Adds a time delta (duration or interval) to a time.

- time

**ceil**

**ceil**

`ceil(n: number) -> number`

Rounds the number up to the next largest integer.

- math

**clamp**

**clamp**

`clamp(value: number, min: number = null, max: number = null) -> number`

Returns `value`

clamped between the bounds of `min`

and `max`

.

Returns

`value`

if`value`

is between`min`

and`max`

. Returns`min`

if`value < min`

. Returns`max`

if`value > max`

. Returns`null`

if`value`

is`null`

, or if`min > max`

. If`min`

or`max`

are`null`

, then no clamping on that side will be performed.

- math

**count**

**count**

`count(input: any) -> u32`

Counts each distinct, non-null value across the input.

- aggregation

**day_of_month**

**day_of_month**

`day_of_month(time: timestamp_ns) -> u32`

Return the day-of-month for the given time, starting with 1.

- time

**day_of_month0**

**day_of_month0**

`day_of_month0(time: timestamp_ns) -> u32`

Return the day-of-month for the given time, starting with 0.

- time

**day_of_year**

**day_of_year**

`day_of_year(time: timestamp_ns) -> u32`

Return the day-of-year for the given time, starting with 1.

- time

**day_of_year0**

**day_of_year0**

`day_of_year0(time: timestamp_ns) -> u32`

Return the day-of-year for the given time, starting with 0.

- time

**days**

**days**

`days(days: i64) -> interval_days`

Produces an interval corresponding to the given number of calendar days.

NOTE: While the argument takes an

`i64`

negative numbers of days and values greater than`i32::MAX`

produce`null`

intervals.

- time

**days_between**

**days_between**

`days_between(t1: timestamp_ns, t2: timestamp_ns) -> interval_days`

Returns the number of days between the first and second timestamp

If the first timestamp is greater than the second, the result will be a positive interval. If the second timestamp is greater than the first, the result with be a negative interval.

- time

**div**

**div**

`div(a: number, b: number) -> number`

Operator: a / b

Returns the division of two numbers.

Note: The result of dividing two numbers maintains the type of number. Numeric values are promoted to be compatible, for instance

`x / 2.0`

would promote`x`

to`f64`

.

- math

**else**

**else**

`else(default: any, value: any) -> any`

Return the `value`

if it is not `null`

, `default`

otherwise.

- logical

**eq**

**eq**

`eq(a: any, b: any) -> bool`

Operator: a == b

Return `true`

if `a`

is equal to `b`

.

- comparison

**exp**

**exp**

`exp(power: f64) -> f64`

Returns `e^power`

.

The exponential function applies to

`f64`

numbers only. Other numbers will be promoted appropriately.

- math

**first**

**first**

`first(input: any) -> any`

Computes the first value present across the input.

NOTE: The first value is inclusive of any values at the current time.

- aggregation

**floor**

**floor**

`floor(n: number) -> number`

Rounds the number down to the next smallest integer.

- math

**gt**

**gt**

`gt(a: ordered, b: ordered) -> bool`

Operator: a > b

Return `true`

if `a`

is greater than `b`

.

- comparison

**gte**

**gte**

`gte(a: ordered, b: ordered) -> bool`

Operator: a >= b

Return `true`

if `a`

is greater than or equal to `b`

.

- comparison

**hash**

**hash**

`hash(input: any) -> u64`

Returns the hash of the `input`

.

- misc

**if**

**if**

`if(condition: bool, value: any) -> any`

Return the `value`

if `condition`

is `true`

, `null`

otherwise.

- logical

**is_valid**

**is_valid**

`is_valid(input: any) -> bool`

Returns `true`

if `input`

is not `null`

.

- misc

**last**

**last**

`last(input: any) -> any`

Computes the last value present across the input.

NOTE: The last value is inclusive of any values at the current time.

- aggregation

**len**

**len**

`len(s: string) -> i32`

Returns the length of the string `s`

.

- string

**logical_and**

**logical_and**

`logical_and(a: bool, b: bool) -> bool`

Operator: a and b

Returns the logical conjunction (AND) of two booleans.

- logical

**logical_or**

**logical_or**

`logical_or(a: bool, b: bool) -> bool`

Operator: a or b

Returns the logical disjunction (OR) of two booleans.

- logical

**lower**

**lower**

`lower(s: string) -> string`

Converts the string to lower case.

- string

**lt**

**lt**

`lt(a: ordered, b: ordered) -> bool`

Operator: a < b

Return `true`

if `a`

is less than `b`

.

- comparison

**lte**

**lte**

`lte(a: ordered, b: ordered) -> bool`

Operator: a < b

Return `true`

if `a`

is less than or equal to `b`

.

- comparison

**max**

**max**

`max(input: ordered) -> ordered`

Computes the maximum of values across the input.

- aggregation
- math

**mean**

**mean**

`mean(input: number) -> f64`

Computes the arithmetic mean of values across the input.

- aggregation
- math

**min**

**min**

`min(input: ordered) -> ordered`

Computes the minimum of values across the input.

- aggregation
- math

**month_of_year**

**month_of_year**

`month_of_year(time: timestamp_ns) -> u32`

Return the month-of-year for the given time, startiing with 1.

This is 1 indexed, with January corresponding to 1.

- time

**month_of_year0**

**month_of_year0**

`month_of_year0(time: timestamp_ns) -> u32`

Return the month-of-year for the given time, startiing with 0.

This is 0 indexed, with January corresponding to 0.

- time

**months**

**months**

`months(months: i64) -> interval_months`

Produces an interval corresponding to the given number of calendar months.

NOTE: While the argument takes an

`i64`

negative numbers of months and values greater than`i32::MAX`

produce`null`

intervals.

- time

**months_between**

**months_between**

`months_between(t1: timestamp_ns, t2: timestamp_ns) -> interval_months`

Returns the number of months between the first and second timestamp

If the first timestamp is greater than the second, the result will be a positive interval. If the second timestamp is greater than the first, the result with be a negative interval.

- time

**mul**

**mul**

`mul(a: number, b: number) -> number`

Operator: a * b

Returns the product of two numbers.

- math

**neg**

**neg**

`neg(n: signed) -> signed`

Operator: -n

Returns the negation of `n`

.

- math

**neq**

**neq**

`neq(a: any, b: any) -> bool`

Operator: a <> b

Return `true`

if `a`

is not equal to `b`

.

- comparison

**not**

**not**

`not(input: bool) -> bool`

Operator: !input

Returns the logical negation of a boolean.

- logical

**null_if**

**null_if**

`null_if(condition: bool, value: any) -> any`

Return the `value`

if `condition`

is `false`

, `null`

otherwise.

- logical

**powf**

**powf**

`powf(base: f64, power: f64) -> f64`

Returns `base^power`

.

The power function applies to

`f64`

numbers only. Other numbers will be promoted appropriately.

- math

**round**

**round**

`round(n: number) -> number`

Rounds the number to the nearest integer.

Note: Rounds half-way numbers away from

`0`

. For example,`0.5`

rounds to`1.0`

and`-0.5`

rounds to`-1.0`

.

- math

**seconds**

**seconds**

`seconds(seconds: i64) -> duration_s`

Produces a duration corresponding to the given number of seconds.

- time

**seconds_between**

**seconds_between**

`seconds_between(t1: timestamp_ns, t2: timestamp_ns) -> duration_s`

Returns the number of seconds between the first and second timestamp

If the first timestamp is greater than the second, the result will be a positive duration. If the second timestamp is greater than the first, the result with be a negative duration.

- time

**shift_to**

**shift_to**

`shift_to(time: timestamp_ns, value: any) -> any`

Produces the current `value`

shifted forward to the given `time`

.

If multiple values for the same group key are shifted to the same time all of them will be emitted in the order they originally appeared. New

`subsort`

IDs will be assigned to each row.

- time

**shift_until**

**shift_until**

`shift_until(predicate: bool, value: any) -> any`

Produces the `value`

shifted forward to the time the `predicate`

is true

If multiple values for the same group key are shifted to the same time, all of them will be emitted in the order they originally appeared. New

`subsort`

IDs will be assigned to each row. A value may be produced at the same time it occurs if the`predicate`

evaluates to true at that time.

- time

**sub**

**sub**

`sub(a: number, b: number) -> number`

Operator: a - b

Returns the difference of two numbers.

- math

**substring**

**substring**

`substring(s: string, start: i64 = null, end: i64 = null) -> string`

Takes a substring of the input bounded by the start and end indices.

Note:

`start`

is inclusive and`end`

is exclusive. The`start`

and`end`

may be left`null`

to indicate the first and last indices of the string respectively. Negative indices may be passed, and are interpreted as counting backwards from the end of the string. E.g.`str[-1] == str[length-1]`

. If`end > start`

, an empty string is returned.

- string

**sum**

**sum**

`sum(input: number) -> number`

Computes the sum of values across the input.

- aggregation
- math

**time_of**

**time_of**

`time_of(input: any) -> timestamp_ns`

Returns the timestamp of the `input`

.

Returns the time the

`input`

, a non-literal expression, produces values. Time is measured as a Unix epoch, counting the seconds from 00:00:00.000 on 1 January 1970, excluding leap seconds as a 64-bit integer.

- time

**timestamp_ns**

**timestamp_ns**

`timestamp_ns(input: timestamp_ns) -> timestamp_ns`

Function to coerce a value to `timestamp_ns`

.

- time

**upper**

**upper**

`upper(s: string) -> string`

Converts the string to upper case.

- string

**variance**

**variance**

`variance(input: number) -> f64`

Computes the sample variance of values across the input.

This uses the sample variance formula, which divides by the number of values minus 1, rather than the population variance which divides by the number of values.

- aggregation
- math

**when**

**when**

`when(condition: bool, value: any) -> any`

Produces the current `value`

when the `condition`

evaluates to `true`

.

If the

`value`

is continuous (eg., the result of an aggregation) returns the latest result of the aggregation. If the`value`

is not continuous (eg., taken directly from events) returns the current`value`

if it exists, and`null`

otherwise.

- time

**year**

**year**

`year(time: timestamp_ns) -> i32`

Return the year of the given timestamp.

- time

**zip_max**

**zip_max**

`zip_max(a: ordered, b: ordered) -> ordered`

Returns the maximum of two values.

Returns

`a`

if`a > b`

, otherwise returns`b`

. Specifically, if`a`

or`b`

is`NaN`

`b`

will be returned.

- math

**zip_min**

**zip_min**

`zip_min(a: ordered, b: ordered) -> ordered`

Returns the minimum of two values.

Returns

`a`

if`a < b`

, otherwise returns`b`

. Specifically, if`a`

or`b`

is`NaN`

`b`

will be returned.

- math

*generated on 2021-09-21 16:15:49Z*

Updated 1 day ago