All Functions

This page lists all functions organized by category. Each function links to its documentation. Use the backend filters to show only functions available on DuckDB, Trino, and/or Serving.

Show only functions available on

Showing all 426 functions

Function Categories

Core

Semantics

FunctionDuckDBTrinoServingDescription
ENTITY()✓✓✓Returns a reference to an entity.
INPUT()✓✓✓Returns a reference to an input.
KEY_TO_SCALAR()✓✓✓Drop the entity annotation and keep the base type and unit
KEY_PAIR()✓✓✓Unordered pair of two identity keys from one family
IS_KEY_BEFORE()✓✓✓True when the first identity key is strictly before the second

Bind

FunctionDuckDBTrinoServingDescription
BIND_VALUE()✓✓✓Binds the given value to the given feature.
BIND_VALUES()✓✓✓Binds the given array of values to the given feature or features.
BIND_COLUMNS()✓✓✓Binds columns from a table to the given features.
@BIND_KEYSET(...)✓✓✓Binds entity keys from a keyset, keyset group, or mapped source.

Structural

FunctionDuckDBTrinoServingDescription
RELATED()✓✓✓Joins a feature or an aggregation using a key as base
UNNEST()✓✓✓Unnests an array of rows into a table of rows

Types

FunctionDuckDBTrinoServingDescription
CAST()✓✓✓Returns the given expression casted to the given type, or raise an exception if the conversion...
UNSAFE_CAST()✓✓✓Returns the given expression casted to the given type, allowing to change or remove entity type
NULL()✓✓✓Returns a NULL value of the given type.
EMPTY()✓✓✓Returns an EMPTY filling for empty parameters in functions.

Functions

FunctionDuckDBTrinoServingDescription
VARIANT()✓✓✓Returns a reference to a variant of the given feature with the given replacements in its...
MACRO()✓✓✓Returns a reference to a macro of the given feature with the given inputs.
UDF()✓✓✓Defines a polymorphic user-defined function with typed signatures and dialect SQL expressions.

Source

Connection

FunctionDuckDBTrinoServingDescription
SOURCE_HTTP()✗✗✓Creates a HTTP connection to the given URI
SOURCE_JDBC()✗✗✓Creates a JDBC connection to the given DSN
SOURCE_REDIS()✗✗✓Creates a Redis connection to the given URI

Mapping

FunctionDuckDBTrinoServingDescription
EXTERNAL_COLUMNS()✓✓✓Mapping of source columns to features.
EXTERNAL_REDIS()✗✗✓Returns the value of the given key and field (optionally) from the given Redis source
EXTERNAL_HTTP()✓✓✓Returns the JSON response from a HTTP call

Conditional

FunctionDuckDBTrinoServingDescription
NULLIF()✓✓✓Returns NULL when two values compare equal; otherwise returns the first value
IF()✓✓✓Returns one value if a condition is true, another if false
CASE WHEN✓✓✓Returns the result of the first condition that evaluates to true
CASE WHEN VALUE✓✓✓Returns the result corresponding to the first matching value in a simple case expression
COALESCE(...)✓✓✓Returns the first non-NULL value from a list of values

Logical

FunctionDuckDBTrinoServingDescription
AND✓✓✓Returns TRUE when both boolean operands are TRUE.
OR✓✓✓Returns TRUE when at least one boolean operand is TRUE.
NOT✓✓✓Returns FALSE if the operand is TRUE, TRUE if it is FALSE.

Comparison

Equality

FunctionDuckDBTrinoServingDescription
= [equals]✓✓✓Returns TRUE if the first value equals the second value
!= [not]✓✓✓Returns TRUE if the first value does not equal the second value
IS NULL✓✓✓Returns TRUE if the expression evaluates to NULL.
IS NOT NULL✓✓✓Returns TRUE if the expression does NOT evaluate to NULL.
DISPLAYS AS✓✓✓Returns TRUE if two values are not distinct, treating NULL values as comparable.
IS NOT DISTINCT FROM✓✓✓Returns TRUE if two values are not distinct, treating NULL values as comparable (SQL-standard...
NOT DISPLAYS AS✓✓✓Returns TRUE if two values are distinct, treating NULL values as comparable.
IS DISTINCT FROM✓✓✓Returns TRUE if two values are distinct, treating NULL values as comparable (SQL-standard spelling).

Ordering

FunctionDuckDBTrinoServingDescription
< [less]✓✓✓Returns TRUE if the first value is strictly less than the second value
<= [less]✓✓✓Returns TRUE if the first value is less than or equal to the second value
> [greater]✓✓✓Returns TRUE if the first value is strictly greater than the second value
>= [greater]✓✓✓Returns TRUE if the first value is greater than or equal to the second value
BETWEEN✓✓✓Returns TRUE if a value is within a specified range (inclusive)
NOT BETWEEN✓✓✓Returns TRUE if a value is NOT within a specified range (inclusive).
LEAST(...)✓✓✓Returns the least (minimum) value from a list of arguments.
GREATEST(...)✓✓✓Returns the greatest (maximum) value from a list of arguments.

Pattern Matching

FunctionDuckDBTrinoServingDescription
LIKE✓✓✓Returns TRUE if a string matches a specified pattern with wildcards.
NOT LIKE✓✓✓Returns TRUE if a string does NOT match a specified pattern with wildcards.
LIKE multiple✓✓✓Case-sensitive or case-insensitive pattern matching: `LIKE` / `ILIKE` with `ANY`, `ALL`, or `NONE`...

Set Operations

FunctionDuckDBTrinoServingDescription
IN✓✓✓Returns TRUE if a value exists in a list of values.
NOT IN✓✓✓Returns TRUE if a value does NOT exist in a list of values.

Math

Arithmetic

FunctionDuckDBTrinoServingDescription
+ [addition]✓✓✓Adds two numeric values, or adds an interval to a date or timestamp.
UNARY_MINUS()✓✓✓Negates a numeric expression (unary minus).
UNARY_PLUS()✓✓✓Explicit unary plus on an expression (no-op on the value).
- [subtraction]✓✓✓Subtracts the right-hand value from the left-hand value (numeric, temporal, or interval forms).
FACTORIAL()✓✓✓Returns the factorial of a non-negative integer (n!).
CLAMP()✓✓✓Constrains a value to a closed interval: the result is the value limited to lie between low and...
* [multiplication]✓✓✓Returns the product of two numbers, or scales an interval by an integer factor.
/ [division]✓✓✓Divides the left-hand number by the right-hand number, producing a DOUBLE result.
// [type-preserving]✓✓✓Divides the left-hand number by the right-hand number while preserving the dividend's type...
% [remainder]✓✓✓Returns the remainder after dividing the left-hand number by the right-hand number.

Rounding

FunctionDuckDBTrinoServingDescription
ROUND()✓✓✓Rounds a number to the nearest integer or to a specified number of decimal places.
TRUNCATE()✓✓✓Returns the integer part of a number by discarding the fractional part.
FLOOR()✓✓✓Returns the largest integer less than or equal to the input.
CEIL()✓✓✓Returns the smallest integer greater than or equal to the input.

Sign And Absolute

FunctionDuckDBTrinoServingDescription
ABS()✓✓✓Returns the absolute value of a number.
SIGN()✓✓✓Returns the sign of a number: -1 for negative, 0 for zero, 1 for positive.

Exponential

FunctionDuckDBTrinoServingDescription
^ [exponentiation]✓✓✓Raises a number to a power (integer or floating-point operands of the same type).
SQRT()✓✓✓Returns the square root of a number.
CBRT()✓✓✓Returns the cube root of a number.
EXP()✓✓✓Returns e raised to the power of the given number.
LN()✓✓✓Returns the natural logarithm (base e) of a number.
LOG()✓✓✓Returns the logarithm of a number to a specified base.

Trigonometric

FunctionDuckDBTrinoServingDescription
COS()✓✓✓Returns the cosine of an angle in radians.
SIN()✓✓✓Returns the sine of an angle in radians.
TAN()✓✓✓Returns the tangent of an angle in radians.
ACOS()✓✓✓Returns the arccosine (inverse cosine) of a number, in radians.
ASIN()✓✓✓Returns the arcsine (inverse sine) of a number, in radians.
ATAN()✓✓✓Returns the arctangent (inverse tangent) of a number, in radians.
ATAN2()✓✓✓Returns the arctangent of y/x, using the signs of both arguments to determine the quadrant.

Hyperbolic

FunctionDuckDBTrinoServingDescription
COSH()✓✓✓Returns the hyperbolic cosine of a number.
SINH()✓✓✓Returns the hyperbolic sine of a number.
TANH()✓✓✓Returns the hyperbolic tangent of a number.

Angle Conversion

FunctionDuckDBTrinoServingDescription
DEGREES()✓✓✓Converts an angle from radians to degrees.
RADIANS()✓✓✓Converts an angle from degrees to radians.

Base Conversion

FunctionDuckDBTrinoServingDescription
FROM_BASE()✗✓✗Returns the decimal (base 10) equivalent of a number expressed in a specified base.
TO_BASE()✓✓✓Returns the string representation of a decimal number in a specified base.

Constant

FunctionDuckDBTrinoServingDescription
E()✓✓✓Returns the mathematical constant e (Euler's number).
PI()✓✓✓Returns the mathematical constant π (pi).

Bucketing

FunctionDuckDBTrinoServingDescription
WIDTH_BUCKET_REGULAR()✗✓✗Returns the bucket number for a value in equally-spaced buckets within a range.
WIDTH_BUCKET()✗✓✗Returns the bucket number for a value in a histogram with custom bin boundaries.

Bitwise

FunctionDuckDBTrinoServingDescription
Bitwise AND✓✗✗Returns the bitwise AND of two bitstrings.
Bitwise OR✓✗✗Returns the bitwise OR of two bitstrings.
Bitwise XOR✓✗✗Returns the bitwise XOR (exclusive OR) of two bitstrings.
Bitwise NOT✓✗✗Returns the bitwise NOT (complement) of a bitstring, flipping every bit.
Bitwise left shift✓✗✗Returns the bitstring shifted left by N positions, filling with zeros on the right.
Bitwise right shift✓✗✗Returns the bitstring shifted right by N positions, filling with zeros on the left.
BIT_COUNT()✓✓✗Returns the number of 1-bits in the two’s-complement binary representation of an integer.

String

Case Conversion

FunctionDuckDBTrinoServingDescription
LOWER()✓✓✓Returns the string with all characters converted to lowercase.
UPPER()✓✓✓Returns the string with all characters converted to uppercase.
TITLE()✓✓✓Returns the string with the first letter of each whitespace-delimited word in uppercase and the...

Padding And Trimming

FunctionDuckDBTrinoServingDescription
TRIM()✓✓✓Returns the string with whitespace from both ends removed.
LTRIM()✓✓✓Returns the string with whitespace from the left (beginning) removed.
RTRIM()✓✓✓Returns the string with whitespace from the right (end) removed.
LPAD()✓✓✓Returns the string padded on the left to a specified length with a padding string.
RPAD()✓✓✓Returns the string padded on the right to a specified length with a padding string.

Search String

FunctionDuckDBTrinoServingDescription
STARTS_WITH()✓✓✓Returns TRUE if a string starts with a specified prefix.
ENDS_WITH()✓✓✓Returns TRUE if a string ends with a specified suffix.
POSITION✓✓✓Returns the 1-based index of the first occurrence of a substring within a string.
STRPOS()✓✓✓Returns the position of a substring within a string, optionally finding the N-th occurrence.

Extraction String

FunctionDuckDBTrinoServingDescription
LEFT()✓✓✓Returns the first `n` characters of the string (or the full string when `n` is greater than its...
RIGHT()✓✓✓Returns the last `n` characters of the string (or the full string when `n` is greater than its...
SUBSTR()✓✓✓Returns a substring from a string starting at a specified position.
SPLIT()✓✓✓Returns an array of substrings from a string split by a delimiter.
SPLIT_PART()✓✓✓Returns a specific part of a string after splitting by a delimiter.

Transformation String

FunctionDuckDBTrinoServingDescription
REVERSE()✓✓✓Returns the string with all characters in reverse order.
REPLACE()✓✓✓Returns the string with all occurrences of a substring replaced with another substring.
FORMAT(...)✓✓✓Builds a VARCHAR from a C-style format string and one scalar argument per placeholder.
TRANSLATE()✓✓✗Returns a string with character-level replacements applied based on character-to-character mappings.
BASE64_ENCODE()✓✗✗Encodes a string as standard Base64 text.
BASE64_DECODE()✓✗✗Decodes a Base64 string back to plain text.
HEX_ENCODE()✓✗✗Encodes a string as a contiguous hexadecimal string (two hex digits per byte).
HEX_DECODE()✓✗✗Decodes a contiguous hexadecimal string back to plain text.
URL_ENCODE()✓✗✗Encodes a string for safe use in URL components using percent-encoding (RFC 3986).
URL_DECODE()✓✗✗Decodes a percent-encoded string (RFC 3986).

Concatenation

FunctionDuckDBTrinoServingDescription
CONCAT(...)✓✓✓Returns a single concatenated string from a list of strings.
|| [concatenation]✓✓✓Concatenates two strings; chains associate to the left (same underlying `CONCAT_FN` bundle as...
CONCAT_WS(...)✓✓✓Returns a concatenated string from a list of strings with a separator between each element.

Character

FunctionDuckDBTrinoServingDescription
LENGTH()✓✓✓Returns the number of characters in a string.
CHR()✓✓✓Returns the character corresponding to the given Unicode code point.
CODEPOINT()✓✓✓Returns the Unicode code point of a one-character string.

Distance

FunctionDuckDBTrinoServingDescription
HAMMING_DISTANCE()✓✓✓Returns the Hamming distance between two strings of equal length.
LEVENSHTEIN_DISTANCE()✓✓✓Returns the Levenshtein (edit) distance between two strings.

Phonetic

FunctionDuckDBTrinoServingDescription
WORD_STEM()✗✓✗Returns the stem (root form) of a word using language-specific stemming rules.
SOUNDEX()✗✓✗Returns a four-character Soundex code representing the phonetic sound of a string.

Validation String

FunctionDuckDBTrinoServingDescription
LUHN_CHECK()✗✓✗Returns TRUE if a string passes the Luhn algorithm (modulus 10 checksum).

Hash

FunctionDuckDBTrinoServingDescription
MD5()✓✓✓Returns the MD5 hash of a string as a 32-character hexadecimal string.
SHA1()✓✓✗Returns the SHA-1 hash of a string as a 40-character hexadecimal string.
SHA256()✓✓✓Returns the SHA-256 hash of a string as a 64-character hexadecimal string.

Regex

FunctionDuckDBTrinoServingDescription
REGEX_CONTAINS()✓✓✓Returns TRUE if the haystack string contains a match for the regular expression pattern (substring...
REGEX_MATCH()✓✓✓Returns TRUE if the entire string matches the regular expression pattern. Unlike REGEX_CONTAINS,...
REGEX_EXTRACT_FIRST()✓✓✓Returns the first substring that matches the pattern, optionally selecting a capture group index (0...
REGEX_EXTRACT_ALL()✓✓✗Returns an array of every non-overlapping substring that matches the pattern, in left-to-right...
REGEX_SPLIT()✓✓✗Splits a string by a regular expression pattern and returns the parts between matches as an array.
REGEX_REPLACE_FIRST()✓✗✓Returns the haystack with the first regular-expression match replaced by the replacement string.
REGEX_REPLACE_ALL()✓✓✓Returns the haystack with every non-overlapping regular-expression match replaced by the...

Date And Time

Date/timestamp arithmetic

FunctionDuckDBTrinoServingDescription
ADD()✓✓✓Returns the timestamp after adding an interval to a date or timestamp.
DATE_ADD()✓✓✓Returns the date/timestamp after adding a given number of a given units to the given date or...
SUBTRACT()✓✓✓Subtracts an interval from a timestamp or date, or returns the interval between two timestamps or...
DATE_SUBTRACT()✓✓✓Returns the number of complete elapsed units in timestamp1 − timestamp2. Chaining-friendly: the...
DATE_DIFF()✓✓✓Returns the number of calendar boundary crossings in timestamp1 − timestamp2. Same argument order...

Calendar queries

FunctionDuckDBTrinoServingDescription
FIRST_DAY_OF()✓✓✓Returns the first calendar day of the period containing the given date or timestamp, as midnight on...
LAST_DAY_OF()✓✓✓Returns the last calendar day of the period containing the given date or timestamp, as midnight on...
DAYS_IN()✓✓✓Returns the number of calendar days in the MONTH, QUARTER, HALF (half-year), or YEAR that contains...

Sequence generation

FunctionDuckDBTrinoServingDescription
SEQUENCE()✓✓✓Generates an inclusive array of dates or timestamps separated by an interval.
DATE_SEQUENCE()✓✓✓Returns an array of timestamps: `count` values beginning at `start`, each separated by `interval`.

Extraction

FunctionDuckDBTrinoServingDescription
DATE_PART()✓✓✓Returns the part of the given timestamp in the given unit.
DAY()✓✓✓Returns the day component of a date or timestamp.
HOUR()✓✓✓Returns the hour component of a date or timestamp.
MINUTE()✓✓✓Returns the minute component of a date or timestamp.
MONTH()✓✓✓Returns the month component of a date or timestamp.
QUARTER()✓✓✓Returns the quarter component of a date or timestamp.
SECOND()✓✓✓Returns the second component of a date or timestamp.
WEEK()✓✓✓Returns the week component of a date or timestamp.
YEAR()✓✓✓Returns the year component of a date or timestamp.

Truncation and formatting

FunctionDuckDBTrinoServingDescription
DATE_TRUNC()✓✓✓Returns the given date or timestamp truncated to the given unit.
DATE_FORMAT()✓✓✓Returns a string from the given date or timestamp and format.
TO_ISO8601()✓✓✓Returns an ISO 8601 string from the given timestamp or interval.

Parsing and construction

FunctionDuckDBTrinoServingDescription
DATE_PARSE()✓✓✓Returns a timestamp from the given string and format.
FROM_ISO8601_TIMESTAMP()✓✓✓Returns a timestamp from the given ISO 8601 string.
MAKE_DATE()✓✓✓Builds a DATE from a ROW of calendar components.
MAKE_TIMESTAMP()✓✓✓Builds a TIMESTAMP from a ROW of calendar and clock components.

Unix time conversion

FunctionDuckDBTrinoServingDescription
FROM_UNIXTIME()✓✓✓Returns a timestamp from the given unix timestamp (BIGINT representation of the number of seconds...
TO_UNIXTIME()✓✓✓Returns a unix timestamp (DECIMAL seconds since 1970-01-01 00:00:00 UTC) from the given date or...

Timezone conversion

FunctionDuckDBTrinoServingDescription
LOCAL_TO_UTC()✓✓✓Treats a naive TIMESTAMP as local wall time in the given zone and returns the same instant as a...
UTC_TO_LOCAL()✓✓✓Interprets a naive UTC TIMESTAMP as an instant and returns it in the given timezone (TIMESTAMPTZ).

Interval operations

FunctionDuckDBTrinoServingDescription
MAKE_INTERVAL()✓✓✓Builds an INTERVAL from a ROW of duration components.
FROM_ISO8601_INTERVAL()✓✗✗Returns an interval from the given ISO 8601 duration string.
INTERVAL_PARSE()✓✓✓Returns an interval from the given duration string.
INTERVAL_TO_MS()✓✓✓Returns the truncated number of milliseconds in the given interval.
TO_ISO8601()✓✓✓Returns an ISO 8601 duration string from the given interval.
MULTIPLY()✓✓✓Scales an interval by an integer factor.

Json

FunctionDuckDBTrinoServingDescription
JSON_PARSE()✓✓✓Returns the given string as a JSON expression.
JSON_PARSE_AS()✓✓✓Returns the value of a JSON expression represented as a string in the given type.
JSON_EXTRACT()✓✓✓Returns the value of the given JSON path in the given JSON expression.
JSON_EXTRACT_SCALAR()✓✓✓Returns the scalar value of the given JSON path in the given JSON expression.
JSON_FORMAT()✓✓✓Returns the given JSON expression as a string.
JSON_ARRAY_COUNT()✓✓✗Returns the number of elements in a JSON array.
JSON_KEYS()✓✗✓Returns the keys of a JSON object as an array of strings.
JSON_TYPE()✓✗✗Returns the type of a JSON value as a string.

Array

Element Access

FunctionDuckDBTrinoServingDescription
ELEMENT_AT_POS()✓✓✓Returns the element at the specified position in an array.
ELEMENTS_AT_POS()✓✓✓Returns the elements at multiple specified positions in an array.
SLICE_LEN()✓✓✓Returns a slice of an array using start:length:step semantics.
SLICE_END()✓✓✓Returns the elements at multiple specified positions in an array.

Search And Lookup

FunctionDuckDBTrinoServingDescription
CONTAINS()✓✓✓Returns TRUE if the array contains the specified element.
CONTAINS_SEQUENCE()✓✓✓Returns TRUE if the array contains the specified sequence as a contiguous subsequence.
ARRAY_POSITION()✓✓✓Returns the 1-based position of the first occurrence of an element in an array.
ARRAY_LOOKUP(...)✓✓✓Returns the value corresponding to a lookup key using parallel key-value arrays.

Filtering And Transformation

FunctionDuckDBTrinoServingDescription
ARRAY_SORT()✓✓✓Returns the sorted version of an array.
ARRAY_REVERSE()✓✓✓Returns the reverse of an array.
ARRAY_ENUMERATE()✓✓✓Returns an array of rows pairing each 1-based position with the corresponding element.
ARRAY_ENUMERATE_FLATTEN()✓✓✓Returns an array of rows pairing each 1-based position with the flattened fields of the...
ARRAY_ROTATE()✓✗✗Returns a new array whose elements are rotated circularly; positive amounts shift left, negative...
NGRAMS()✓✓✓Returns adjacent n-element sub-sequences (n-grams) sliding across the input array.
ARRAY_DISTINCT()✓✓✓Returns an array with distinct elements, in order of first occurrence.
ARRAY_REMOVE()✓✓✓Returns an array with all occurrences of the specified element removed.
FLATTEN()✓✓✓Flattens a nested array structure into a single-level array.

Set Operations

FunctionDuckDBTrinoServingDescription
ARRAY_UNION()✓✓✓Returns the union of two arrays, keeping the first occurrence of each element.
ARRAY_INTERSECT()✓✓✓Returns the intersection of two arrays using set semantics.
ARRAY_EXCEPT()✓✓✓Returns the difference of two arrays using set semantics.
ARRAYS_OVERLAP()✓✓✓Returns TRUE if any elements are common between the two arrays.

Aggregation And Statistics

FunctionDuckDBTrinoServingDescription
ARRAY_COUNT()✓✓✓Returns the number of elements in an array.
ARRAY_SUM()✓✓✓Returns the sum of all numeric elements in an array.
ARRAY_PRODUCT()✓✗✗Returns the product of all numeric elements in an array as a DOUBLE.
ARRAY_MEDIAN()✓✗✗Returns the statistical median of numeric array elements as a DOUBLE.
ARRAY_STDDEV_POP()✓✗✗Returns the population standard deviation (divide by N) of numeric array elements as a DOUBLE.
ARRAY_STDDEV_SAMP()✓✗✗Returns the sample standard deviation (divide by N-1) of numeric array elements as a DOUBLE.
ARRAY_VAR_POP()✓✗✗Returns the population variance (divide by N) of numeric array elements as a DOUBLE.
ARRAY_VAR_SAMP()✓✗✗Returns the sample variance (divide by N-1) of numeric array elements as a DOUBLE.
ARRAY_AVG()✓✓✓Returns the arithmetic mean (average) of all numeric elements in an array.
ARRAY_MIN()✓✓✓Returns the smallest value in an array using natural ordering.
ARRAY_MAX()✓✓✓Returns the largest value in an array using natural ordering.
ARRAY_HISTOGRAM()✓✓✓Returns a frequency histogram of values in an array as an array of value-count pairs.

Boolean Operations

FunctionDuckDBTrinoServingDescription
ALL(...)✓✓✓Returns TRUE if all elements in the boolean array are true.
ANY(...)✓✓✓Returns TRUE if any element in the boolean array is true.
NONE(...)✓✓✓Returns TRUE if no elements in the boolean array are true.
ARRAY_NOT()✓✓✓Returns an array with inverted boolean values (logical NOT applied to each element).

Array Combination

FunctionDuckDBTrinoServingDescription
ARRAY_CONCAT(...)✓✓✓Concatenates multiple arrays into a single combined array with optional deduplication.
COMBINATIONS()✓✓✓Returns all 2-element sub-groups of the input array as an array of 2-element arrays.
PERMUTATIONS()✓✓✓Returns all ordered 2-element selections from the input array as an array of 2-element arrays.

Array Generation

FunctionDuckDBTrinoServingDescription
REPEAT()✓✓✓Creates an array by repeating an element a specified number of times.

String Conversion

FunctionDuckDBTrinoServingDescription
ARRAY_JOIN()✓✓✓Joins the elements of an array into a single string using a specified delimiter.

Vector Operations

FunctionDuckDBTrinoServingDescription
COSINE_SIMILARITY()✓✓✓Calculates the cosine similarity between two arrays.
DOT_PRODUCT()✓✓✓Calculates the dot product of two arrays.
EUCLIDEAN_DISTANCE()✓✓✓Calculates the Euclidean distance between two arrays.
NORMALIZE()✓✓✓Normalizes a numeric array by dividing each element by the sum of all elements.

Row

FunctionDuckDBTrinoServingDescription
MERGE(...)✓✓✓Merges multiple row structures into a single row with combined fields

Array Of Rows

Indexing

FunctionDuckDBTrinoServingDescription
INDEX_UNIQUE()✓✓✓Returns an index unique computed from the given array and key.
INDEX_MULTI()✓✓✓Returns an index multi computed from the given array and key.
ELEMENT_AT_KEY()✓✓✓Returns one element at the given key from the given index, array or array of rows.
ELEMENTS_AT_KEY()✓✓✓Returns multiple elements at the given key from the given index, array or array of rows.

Other

FunctionDuckDBTrinoServingDescription
EXTRACT(...)✓✓✓Returns the extracted fields from the given expression.
UNWRAP()✓✓✓Returns the first field values from an array of single-field rows as a simple array.
UNWRAP_ONE()✓✓✓Returns the value of the first field of the first element in an array of single-field rows.
ZIP(...)✓✓✓Combines multiple arrays into a single array of structured rows with named fields.
ARRAY_MERGE(...)✓✓✓Merges multiple arrays of rows element-wise into a single array of combined rows, with optional...
CARRY(...)✓✓✓Carries one or more scalar values into each row of an array of rows, adding them as new fields
EXTEND(...)✓✓✓Adds computed feature fields to a base row or array of rows with field bindings
TRANSFORM✓✓✓Transforms an array of rows using a subquery with optional METHOD
RECURSE(...)✓✗✗Produces an array of rows by iterating a seed ROW, optionally traversing entity relationships

Group By

Numeric

FunctionDuckDBTrinoServingDescription
SUM() GROUP BY ...✓✓✓Returns the sum of the values in the group.
AVG() GROUP BY ...✓✓✓Returns the average of the values in the group.
MAX() GROUP BY ...✓✓✓Returns the maximum value in the group.
MIN() GROUP BY ...✓✓✓Returns the minimum value in the group.
PRODUCT() GROUP BY ...✓✓✓Returns the product of the numeric values in the group.
BIT_AND() GROUP BY ...✓✓✓Returns the bitwise AND of all integer values in the group.
BIT_OR() GROUP BY ...✓✓✓Returns the bitwise OR of all integer values in the group.
BIT_XOR() GROUP BY ...✓✓✓Returns the bitwise XOR of all integer values in the group.

Counting

FunctionDuckDBTrinoServingDescription
COUNT() GROUP BY ...✓✓✓Returns the number of values in the group.
COUNT_IF() GROUP BY ...✓✓✓Returns the number of values in the group that are true.
APPROX_DISTINCT() GROUP BY ...✓✓✓Returns the approximate number of distinct values in the group.

Boolean

FunctionDuckDBTrinoServingDescription
BOOL_AND() GROUP BY ...✓✓✓Returns TRUE if all values in the group are true.
BOOL_OR() GROUP BY ...✓✓✓Returns TRUE if any value in the group is true.

Collection

FunctionDuckDBTrinoServingDescription
ANY_VALUE() GROUP BY ...✓✓✓Returns an arbitrary value from the group.
ARRAY_AGG() GROUP BY ...✓✓✓Returns an array of the values in the group.
MIN_BY() GROUP BY ...✓✓✓Returns the minimum value in the group by the given expression.
MAX_BY() GROUP BY ...✓✓✓Returns the maximum value in the group by the given expression.
STRING_AGG() GROUP BY ...✓✓✓Concatenates string values in the group, separated by the given delimiter; optional inner ORDER BY...

Statistical

FunctionDuckDBTrinoServingDescription
STDDEV_POP() GROUP BY ...✓✓✓Returns the population standard deviation of the values in the group.
STDDEV_SAMP() GROUP BY ...✓✓✓Returns the sample standard deviation of the values in the group.
VAR_POP() GROUP BY ...✓✓✓Returns the population variance of the values in the group.
VAR_SAMP() GROUP BY ...✓✓✓Returns the sample variance of the values in the group.
CORR() GROUP BY ...✓✓✓Returns the Pearson correlation coefficient between two expressions.
COVAR_POP() GROUP BY ...✓✓✓Returns the population covariance between two expressions.
COVAR_SAMP() GROUP BY ...✓✓✓Returns the sample covariance between two expressions.
REGR_SLOPE() GROUP BY ...✓✓✓Returns the slope of the linear regression line fitted to (x, y) pairs.
REGR_INTERCEPT() GROUP BY ...✓✓✓Returns the y-intercept of the linear regression line fitted to (x, y) pairs.
REGR_R2() GROUP BY ...✓✓✓Returns the coefficient of determination (R²) of the linear regression.
APPROX_PERCENTILE() GROUP BY ...✓✓✓Returns the approximate value at the given percentile.
MEDIAN() GROUP BY ...✓✓✓Returns the median of the values in the group as DOUBLE.
QUANTILE_CONT() GROUP BY ...✓✓✓Returns the continuous quantile of the group at the given probability in (0, 1); result type is...
QUANTILE_DISC() GROUP BY ...✓✓✓Returns an element from the group at the given discrete quantile; result type matches the...

Window Function

Numeric

FunctionDuckDBTrinoServingDescription
SUM() OVER ...✓✓✓Returns the sum of values in the window frame.
AVG() OVER ...✓✓✓Returns the average of values in the window frame.
MIN() OVER ...✓✓✓Returns the minimum value in the window frame.
MAX() OVER ...✓✓✓Returns the maximum value in the window frame.
PRODUCT() OVER ...✓✗✗Returns the product of values in the window frame.
BIT_AND() OVER ...✓✗✗Returns the bitwise AND of integer values in the window frame.
BIT_OR() OVER ...✓✗✗Returns the bitwise OR of integer values in the window frame.
BIT_XOR() OVER ...✓✗✗Returns the bitwise XOR of integer values in the window frame.

Counting

FunctionDuckDBTrinoServingDescription
COUNT() OVER ...✓✓✓Returns the count of rows in the window frame.
COUNT_IF() OVER ...✓✓✓Returns the count of rows where the condition is true in the window frame.
APPROX_DISTINCT() OVER ...✓✓✓Returns the approximate number of distinct values in the window frame.

Boolean

FunctionDuckDBTrinoServingDescription
BOOL_AND() OVER ...✓✓✓Returns TRUE if all boolean values in the window frame are true.
BOOL_OR() OVER ...✓✓✓Returns TRUE if any boolean value in the window frame is true.

Numbering

FunctionDuckDBTrinoServingDescription
ROW_NUMBER() OVER ...✓✓✓Returns a unique sequential number for each row within its partition, starting at 1.
RANK() OVER ...✓✓✓Returns the rank of the current row within its partition, with gaps. Rows with equal values for the...
DENSE_RANK() OVER ...✓✓✓Returns the rank of the current row within its partition, without gaps. Similar to RANK but...
NTILE() OVER ...✓✓✓Returns the bucket number (1 to n) for each row in a partition, where n is the number of buckets.
PERCENT_RANK() OVER ...✓✓✓Returns the relative rank of the current row: (rank - 1) / (total rows - 1).
CUME_DIST() OVER ...✓✓✓Returns the cumulative distribution: (number of rows <= current row) / (total rows).

Offset

FunctionDuckDBTrinoServingDescription
LEAD() OVER ...✓✓✓Returns the value from the row that leads (follows) the current row by a specified offset within...
LAG() OVER ...✓✓✓Returns the value from the row that lags (precedes) the current row by a specified offset within...
FIRST_VALUE() OVER ...✓✓✓Returns the first value in the window frame.
LAST_VALUE() OVER ...✓✓✓Returns the last value in the window frame.
NTH_VALUE() OVER ...✓✓✓Returns the value at the nth row of the window frame.

Collection

FunctionDuckDBTrinoServingDescription
ANY_VALUE() OVER ...✓✓✓Returns an arbitrary non-null value from the window frame, if one exists.
ARRAY_AGG() OVER ...✓✓✓Returns an array of all values in the window frame.
MIN_BY() OVER ...✓✓✗Returns the value of the first expression corresponding to the minimum value of the second...
MAX_BY() OVER ...✓✓✗Returns the value of the first expression corresponding to the maximum value of the second...
STRING_AGG() OVER ...✓✗✗Concatenates string values in the window frame in order up to the current row, separated by the...

Statistical

FunctionDuckDBTrinoServingDescription
STDDEV_POP() OVER ...✓✓✓Returns the population standard deviation over the window frame.
STDDEV_SAMP() OVER ...✓✓✓Returns the sample standard deviation over the window frame.
VAR_POP() OVER ...✓✓✓Returns the population variance over the window frame.
VAR_SAMP() OVER ...✓✓✓Returns the sample variance over the window frame.
CORR() OVER ...✓✓✓Returns the Pearson correlation coefficient over the window frame.
COVAR_POP() OVER ...✓✓✓Returns the population covariance over the window frame.
APPROX_PERCENTILE() OVER ...✓✓✓Returns the approximate value at the given percentile in the window frame.
MEDIAN() OVER ...✓✗✗Returns the median of values in the window frame as DOUBLE.
QUANTILE_CONT() OVER ...✓✗✗Returns the continuous quantile of the window at the given probability; result type is DOUBLE.
QUANTILE_DISC() OVER ...✓✗✗Returns the discrete quantile of the window at the given probability; result type matches the value...
COVAR_SAMP() OVER ...✓✓✓Returns the sample covariance over the window frame.
REGR_SLOPE() OVER ...✓✓✓Returns the slope of the linear regression line over the window frame.
REGR_INTERCEPT() OVER ...✓✓✓Returns the y-intercept of the linear regression line over the window frame.
REGR_R2() OVER ...✓✓✓Returns the coefficient of determination (R²) over the window frame.

Metadata

Exploration

FunctionDuckDBTrinoServingDescription
IS_DOWNSTREAM_OF()✓✗✗Returns TRUE if the current feature is dependent of the given feature in the dependency DAG
IS_UPSTREAM_OF()✓✗✗Returns TRUE if the current feature is a dependency of the given feature in the dependency DAG
DEPTH_RELATIVE_TO()✓✗✗Returns the depth of the current feature relative to the given feature in the dependency DAG

Other

FunctionDuckDBTrinoServingDescription
KEYSET()✓✓✓Returns a reference to a keyset.
KEYSET_GROUP()✓✓✓Defines an ordered set of interchangeable keysets.
PREPARED_STATEMENT()✓✓✓Returns a reference to a prepared statement of the given feature with the given inputs.
TYPEOF()✓✓✓Returns the type of the given expression in FeatureQL.
DESCRIBE()✓✓✓Returns catalog and type metadata for an expression as a typed ROW.
SQLTYPEOF()✓✓✓Returns the name of the translated storage type for the expression (after FeatureQL is lowered for...
VERSION()✓✓✓Returns registry version; reload time is set only on a dev workstation.
SQLVERSION()✓✓✓Returns the active SQL dialect name and the backend database version.

Business

Time Travel

FunctionDuckDBTrinoServingDescription
SCD_AT_TIME()✓✓✓Returns the state of an SCD (slowly changing dimension) value at the given point in time.
ACCUMULATION_AT_TIME()✓✓✓Returns the state of an accumulation of events at the given point in time.

Growth Accounting

FunctionDuckDBTrinoServingDescription
TO_ACTIVITY_BITS()✓✓✓Returns the activity bits for the given array of activity dates and date reference.
FROM_ACTIVITY_BITS()✓✓✓Returns the activity dates for the given activity bits and date reference.
BINARY_REPRESENTATION()✓✓✓Returns the binary representation as a string of the given activity bits
UPDATE_ACTIVITY_BIT()✓✓✓Returns the activity bits for the given activity bits and whether the current day is active.
IS_ACTIVE()✓✓✓Returns whether the given activity bits is active for the given time period
ACTIVITY_STATUS()✓✓✓Returns the activity status between two time periods for the given activity bits
COUNT_ACTIVE()✓✓✓Returns the number of active days for the given activity bits and time period
RECENCY()✓✓✓Returns the number of days since the last active day for the given activity bits

Experimentation

FunctionDuckDBTrinoServingDescription
HASH01()✓✓✓Returns a value between 0 and 1 based on the given hashing key.
GRADUAL_ROLLOUT()✓✓✓Returns the exposure to a new version based on the given hashing key and rollout parameters.

Simulations

FunctionDuckDBTrinoServingDescription
SAMPLE_UNIFORM()✓✓✓Returns a value uniformly chosen between two bounds based on the given hashing key.
SAMPLE_GAUSSIAN()✓✓✓Returns a value chosen from a normal distribution between two bounds based on the given hashing key.
SAMPLE_VALUE(...)✓✓✓Returns a value from the given array of values and proportions based on the given hashing key.
SAMPLE_BOOL()✓✓✓Returns the discrete event (true or false) with the given probability based on the given hashing...
SAMPLE_EXPONENTIAL()✓✓✓Returns a value drawn from an exponential distribution with the given rate, based on the given...
SAMPLE_POISSON()✓✓✗Returns an integer drawn from a Poisson distribution with the given rate, based on the given...
SAMPLE_LOGNORMAL()✓✓✓Returns a value drawn from a log-normal distribution, clamped to [lower, upper], based on the given...
SAMPLE_GEOMETRIC()✓✓✓Returns the number of trials until first success, drawn from a geometric distribution, based on the...
SAMPLE_WEIBULL()✓✓✓Returns a value drawn from a Weibull distribution based on the given hashing key.

Metaprogramming

Non Deterministic

FunctionDuckDBTrinoServingDescription
CURRENT_TIMESTAMP()✓✓✓Returns the current date and time.
RANDOM()✓✓✓Returns a random number in the range 0.0 <= x < 1.0

Other

FunctionDuckDBTrinoServingDescription
EVAL_CONST()✓✓✓Returns the result of evaluating a constant formula as a literal.

Geospatial

Constructor

FunctionDuckDBTrinoServingDescription
ST_GEOMPOINT()✓✓✗Creates a GEOMETRY point from x and y coordinates.
ST_GEOGPOINT()✓✓✗Creates a GEOGRAPHY point from longitude and latitude coordinates in WGS84.
ST_GEOMFROMTEXT()✓✓✗Creates a GEOMETRY value from a WKT (Well Known Text) string.
ST_GEOGFROMTEXT()✓✓✗Creates a GEOGRAPHY value from a WKT (Well Known Text) string. Coordinates are interpreted as...
ST_MAKELINE()✓✗✗Creates a LINESTRING from two geometry or geography inputs.
ST_MAKEPOLYGON()✓✗✗Creates a POLYGON from a closed LineString shell.
ST_COLLECT()✓✗✗Combines two geometries or geographies into a collection without dissolving boundaries.
ST_GEOMFROMWKB()✓✓✗Creates a GEOMETRY value from a WKB (Well Known Binary) byte string.
ST_GEOGFROMWKB()✓✓✗Creates a GEOGRAPHY value from a WKB (Well Known Binary) byte string. Coordinates are interpreted...
ST_GEOMFROMGEOJSON()✓✗✗Creates a GEOMETRY value from a GeoJSON string.
ST_GEOGFROMGEOJSON()✓✗✗Creates a GEOGRAPHY value from a GeoJSON string. Coordinates are interpreted as lon/lat in WGS84.
ST_TOGEOGRAPHY()✓✓✗Casts a GEOMETRY to GEOGRAPHY, reinterpreting coordinates as lon/lat in WGS84 without reprojection.
ST_TOGEOMETRY()✓✓✗Casts a GEOGRAPHY to GEOMETRY, reinterpreting the WGS84 lon/lat coordinates as planar x/y without...

Serialization

FunctionDuckDBTrinoServingDescription
ST_ASTEXT()✓✓✗Returns the WKT (Well Known Text) representation of a geometry or geography.
ST_ASGEOJSON()✓✗✗Returns the GeoJSON representation of a geometry or geography.
ST_ASWKB()✓✓✗Returns the WKB (Well Known Binary) representation of a geometry or geography.

Measurement

FunctionDuckDBTrinoServingDescription
ST_DISTANCE()✓✓✗Returns the minimum distance between two geometries or geographies.
ST_AREA()✓✓✗Returns the area of a geometry or geography.
ST_LENGTH()✓✓✗Returns the length of a linear geometry or geography.
ST_PERIMETER()✓✗✗Returns the perimeter of an areal geometry or geography.
ST_AZIMUTH()✓✓✗Returns the azimuth angle in radians from point A to point B, measured clockwise from north...

Predicate

FunctionDuckDBTrinoServingDescription
ST_INTERSECTS()✓✓✗Returns TRUE if two geometries or geographies share any portion of space.
ST_CONTAINS()✓✓✗Returns TRUE if geometry/geography A fully contains geometry/geography B.
ST_WITHIN()✓✓✗Returns TRUE if geometry/geography A is fully within geometry/geography B.
ST_DWITHIN()✓✓✗Returns TRUE if the distance between two geometries or geographies is less than or equal to a...
ST_EQUALS()✓✓✗Returns TRUE if two geometries or geographies represent the same point set.
ST_DISJOINT()✓✓✗Returns TRUE if two geometries or geographies do not share any space.
ST_TOUCHES()✓✓✗Returns TRUE if two geometries share boundary points but no interior points.
ST_CROSSES()✓✓✗Returns TRUE if two geometries have some but not all interior points in common.
ST_OVERLAPS()✓✓✗Returns TRUE if two geometries of the same dimension have overlapping interiors.

Accessor

FunctionDuckDBTrinoServingDescription
ST_X()✓✓✗Returns the X coordinate of a point (or longitude for geography).
ST_Y()✓✓✗Returns the Y coordinate of a point (or latitude for geography).
ST_GEOMETRYTYPE()✓✓✗Returns the OGC type name of a geometry or geography as a string.
ST_NUMPOINTS()✓✗✗Returns the total number of vertices in a geometry or geography.
ST_NUMGEOMETRIES()✓✓✗Returns the number of sub geometries in a collection, or 1 for singular geometries.
ST_DIMENSION()✓✓✗Returns the topological dimension of a geometry or geography.
ST_ISEMPTY()✓✓✗Returns TRUE if a geometry or geography is empty.
ST_ISVALID()✓✓✗Returns TRUE if a geometry is topologically valid (no self intersections, proper ring closure,...
ST_SRID()✓✗✗Returns the SRID (Spatial Reference ID) of a geometry.
ST_ISCLOSED()✓✓✗Returns TRUE if a geometry is closed (start point equals end point for lines; always TRUE for...
ST_STARTPOINT()✓✓✗Returns the first vertex of a LineString.
ST_ENDPOINT()✓✓✗Returns the last vertex of a LineString.
ST_ISSIMPLE()✓✓✗Returns TRUE if a geometry has no anomalous geometric points such as self-intersections or...
ST_GEOMPOINTN()✓✓✗Returns the Nth vertex of a LineString (1-indexed).
ST_ISPOINT()✓✓✗Returns TRUE if the geometry or geography is a Point.
ST_EXTERIORRING()✓✓✗Returns the outer ring of a Polygon as a LineString.
ST_ISLINE()✓✓✗Returns TRUE if the geometry or geography is a LineString.
ST_ISPOLYGON()✓✓✗Returns TRUE if the geometry or geography is a Polygon.
ST_NUMINTERIORRINGS()✓✓✗Returns the number of interior rings (holes) in a Polygon.
ST_INTERIORRINGN()✓✗✗Returns the Nth interior ring (hole) of a Polygon as a LineString (1-indexed).
ST_ISCOLLECTION()✓✓✗Returns TRUE if the geometry or geography is a Multi* or GeometryCollection.
ST_GEOMETRYN()✓✓✗Returns the Nth sub-geometry from a geometry collection (1-indexed).

Transformation

FunctionDuckDBTrinoServingDescription
ST_CENTROID()✓✓✗Returns the geometric center of mass (centroid) of a geometry or geography.
ST_BUFFER()✓✗✗Returns a geometry/geography that represents all points within a given distance of the input.
ST_ENVELOPE()✓✓✗Returns the bounding box of a geometry or geography as a polygon.
ST_CONVEXHULL()✓✗✗Returns the convex hull of a geometry or geography.
ST_SIMPLIFY()✓✓✗Returns a simplified version of a geometry using the Douglas Peucker algorithm.
ST_INTERSECTION()✓✗✗Returns the geometry/geography representing the point set intersection of two inputs.
ST_UNION()✓✗✗Returns the geometry/geography representing the point set union of two inputs.
ST_DIFFERENCE()✓✗✗Returns the geometry/geography representing the point set difference of A minus B.
ST_SYMDIFFERENCE()✓✗✗Returns the geometry/geography representing the point set symmetric difference of two inputs (union...
ST_REVERSE()✓✗✗Returns a geometry with the vertex order of each component reversed.
ST_SNAP_TO_GRID()✓✗✗Snaps all vertices of a geometry to a uniform grid with the given cell size.
ST_SETSRID()✓✗✗Sets the SRID on a geometry without modifying or reprojecting coordinates.
ST_TRANSFORM()✓✗✗Reprojects a geometry from its current SRID to a target SRID.
ST_DUMP()✓✗✗Explodes a Multi* or GeometryCollection into an array of its component geometries.

Aggregation

FunctionDuckDBTrinoServingDescription
ST_UNION_AGG()✓✗✗Aggregate function that dissolves all geometries in a group into a single geometry.
ST_COLLECT_AGG()✓✗✗Aggregate function that collects all geometries in a group into a single GeometryCollection without...
ST_EXTENT()✓✗✗Aggregate function that returns the bounding box of all geometries in a group as a polygon.

Summary
Showing 431 of 426 functions across 19 of 19 categories.

This documentation is automatically generated from the FeatureMesh registry.