Function Library, Overview, & Glossary
Mappings: Functions and Expressions · Updated June 9, 2025
Introduction
This document provides an overview of the function library available in Reactor for use in mapping expressions. It also includes a glossary of some terms used within the function descriptions. The function library offers a range of tools to manipulate and transform data during the mapping process.
Types of Functions
-
Date and Time Functions
Functions that operate on date, datetime, or timestamp values. These functions extract specific components (such as year, month, day, hour, minute, second, microsecond) from date/time values, or perform calculations involving dates and times. -
Logic Functions
Functions that return Boolean values (true or false) based on logical conditions. These functions perform conditional evaluations, such as checking equality or inequality, and combining multiple conditions using logical operators. -
Math Functions
Functions that perform mathematical operations on numeric values. These include basic arithmetic operations (addition, subtraction, multiplication, division) and more advanced calculations like modulo and exponentiation. -
Operator Functions
Functions that utilize operators to perform comparisons and logical evaluations. Operators include equality (==), inequality (!=), greater than (>), less than (<), logical AND (&&), logical OR (||), and negation (!). -
Statistic Functions
Functions that compute statistical measures over a set of values. These functions calculate aggregates such as count, sum, average, minimum, maximum, and other statistical metrics. -
Structure Functions
Functions that manipulate structured data types like arrays, lists, or records. These functions allow for mapping, filtering, flattening, and constructing new data structures from existing ones. -
Text Functions
Functions that perform operations on string values. These include concatenation, substring extraction, case conversion, pattern matching, and other text manipulation tasks.
Date, Time, and Timezone Definitions
-
date: A calendar date in YYYY-MM-DD format. Used in Reactor to define the day component of time when no time-of-day is required. Example: '2025-12-31'. -
datetime: A full timestamp string that combines date and time, used for representing business events that occur at a particular moment regardless of time zone. Example: '2025-12-31 23:59:59'. -
day: A numeric value representing the day (1–31) portion of a date. Used in date extraction and roll-up logic. -
hour: Represents the hour (0–23) of a given datetime or timestamp. Critical for time-based aggregations or usage pattern analytics. -
microsecond: High-precision component of time measurement (millionths of a second). Used in Reactor only when input sources provide such precision. -
minute: The minute (0–59) extracted from datetime or timestamp values. Frequently used for grouping or temporal slicing. -
month: The month (1–12) portion of a date or datetime value. Important for partitioning and monthly report logic. -
second: The seconds (0–59) portion of a timestamp. Used in fine-grain event timestamping. -
timestamp: An absolute point in time aligned to UTC, including date and time down to microseconds. Primary datatype for storing and comparing events in Reactor’s data streams. -
timezone: A region- or offset-based identifier for representing time zone context (e.g., 'UTC', 'America/New_York'). Used in conversion and normalization operations across time zones. See the article on Wikipedia on the list of tz database time zones. -
year: A four-digit integer representing the calendar year (e.g., 2025). Used in annual aggregates and date filters.
Date and Time Functions
- DATE: Constructs a date object
- PARSE_DATE: Parses a string into a date object
- DATETIME: Constructs a datetime object
- PARSE_DATETIME: Parses a string into a datetime object
- CURRENT_DATE: Returns the current date
- CURRENT_DATETIME: Returns the current datetime
- TIMESTAMP: Returns a timestamp from an expression
- PARSE_TIMESTAMP: Parses a string into a timestamp object
- TIMESTAMP_SECONDS: Returns a datetime object from seconds since epoch
- TIMESTAMP_MILLIS: Returns a datetime object from milliseconds since epoch
- TIMESTAMP_MICROS: Returns a datetime object from microseconds since epoch
- CONVERT_TIMEZONE: Converts a datetime object from one timezone to another
- DATE_TRUNC: Truncates a date
- DATE_DIFF: Calculates the difference between two dates
- DATETIME_TRUNC: Truncates a datetime
- DATETIME_DIFF: Calculates the difference between two datetimes
- TIMESTAMP_DIFF: Calculates the difference between two timestamps
- DATE_ADD: Adds time to a date
- DATETIME_ADD: Adds time to a datetime
- TIMESTAMP_ADD: Adds time to a timestamp
Aggregation Functions
- MAX: Returns the maximum value
- AVERAGE /AVG: Returns the average of numerical values
- MIN: Returns the minimum value
- EQ: Checks if two values are equal
- NE: Checks if two values are not equal
- LT: Checks if a value is less than another
- GT: Checks if a value is greater than another
- LTE: Checks if a value is less than or equal to another
- GTE: Checks if a value is greater or equal to another
- ISBETWEEN: Checks if a value is between two other values
Conversion
- BOOL: Converts to True/False
- INT: Converts to integers
- DECIMAL: Converts to decimals
- NUMBER: Converts to numbers
- TYPE: Returns the type of a value
Logic
- IF: Returns one value if a condition is true, otherwise another
- IDENTITY: Returns the value passed in
- LAMBDA: Creates a custom function - See more below on this function
- NOT: Returns the opposite of a logical value
- AND: Returns true if all arguments are true
- OR: Returns true if any argument is true
- XOR: Returns true if an odd number of arguments are true
- APPLY: Applies values to a lambda function
- IFERROR: Returns the expression's value unless it's an error
- SWITCH: Tests an expression against cases
Math
- NEGATE /UMINUS: Negates a value
- MULTIPLY /PRODUCT: Multiplies values
- SUM /ADD: Sums values
- SUBTRACT/MINUS: Subtracts values
- ABS: Returns the absolute value
- MOD: Returns the modulo
- ROUND: Rounds a number
- ROUNDDOWN: Rounds a number down
- ROUNDUP: Rounds a number up
- POW/POWER: Raises a number to the power of an exponent
- DIVIDE/QUOTIENT: Divides values
String
- LEN: Returns the length of a string or array
- CONCAT: Concatenates strings or arrays
- JOIN: Joins a list into a string with a delimiter
- SPLIT: Splits a string by a delimiter into a list
- FIND: Finds the first location of a substring (case-sensitive)
- SEARCH: Finds the first location of a substring (case-insensitive)
- SHA256: Returns the SHA256 hash of a string
Structure
- GET: Retrieves a field's value from an object
- ELEMENT: Returns the element at an index in a list
- INDEX: Returns the index of a value in a list
- LIST: Creates a new list
- FLATMAP: Applies a function to each element and flattens the result
- FLATTEN: Flattens nested lists
- MAP: Applies a function to each element of a collection
- FILTER: Filters elements from a collection
- COALESCE: Returns the first non-NULL value
- LIFT_RESULT: Indicates an expression should replace the result value
Lambda Helper Function
A Lambda Helper Function in Reactor enables you to apply logic to structured data collections like arrays or nested objects. You can define a reusable transformation and apply it to each element using the keyword each.
1 each
This construct enables powerful data shaping without writing repetitive logic. It's particularly useful for line-item transformations, record flattening, or applying functions to sets of values within records.
Supported Lambda functions:
-
Apply: Executes a transformation across all elements.
-
Filter: Retains elements that meet a given condition.
-
Flatmap: Unwraps and transforms nested values into a flat list.
-
List: Constructs or manipulates an array.
-
Map: Applies a logic block and returns a modified collection.
Operator Expressions
The following operators are supported in Reactor’s transformation and mapping layers:
| Operator | Description |
|---|---|
, |
Separates arguments in a list or function call |
| ` | |
&& |
Logical AND – true only if both conditions are true |
==, !=
|
Equality and inequality checks |
<, >, <=, >=
|
Comparison operators |
+, -
|
Addition and subtraction |
*, /
|
Multiplication and division |
%, ^
|
Modulo and exponentiation |
! |
Boolean NOT |
(), []
|
Used for grouping and indexing structures |