Skip to main content
ReferenceApplies to: Unified engine deployments
Functions are grouped by purpose below. The inventory on this page is generated from the exact function registry compiled into Unified and includes canonical names, aliases, syntax, and argument documentation.

Function reference

Resolution and return types

Function names and aliases resolve without ASCII case sensitivity. Overload selection depends on argument types. Return types can depend on input types, decimal precision, or nested element types; use the result column schema to inspect the resolved type for a live query. A registered function name means the planner can resolve it. Execution also depends on argument types and the selected backend. This inventory is not a promise that every upstream function can execute on every backend. The family pages document tested examples and relevant restrictions.

Unified aliases

struct(...) derives field names. map(...) accepts alternating keys and values. collect_list and collect_set are explicitly unavailable despite similar aggregate names in other systems. SHOW FUNCTIONS is currently unavailable; use the inventory below.

Registered functions

The inventory lists names, aliases, families, signatures, descriptions, and arguments. Internal arithmetic helpers are excluded. Descriptive function metadata comes from the engine’s Apache-2.0 DataFusion dependencies; Unified-specific restrictions take precedence.

Math Functions

abs

Kind: Scalar.
Returns the absolute value of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

acos

Kind: Scalar.
Returns the arc cosine or inverse cosine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

acosh

Kind: Scalar.
Returns the area hyperbolic cosine or inverse hyperbolic cosine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

asin

Kind: Scalar.
Returns the arc sine or inverse sine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

asinh

Kind: Scalar.
Returns the area hyperbolic sine or inverse hyperbolic sine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

atan

Kind: Scalar.
Returns the arc tangent or inverse tangent of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

atan2

Kind: Scalar.
Returns the arc tangent or inverse tangent of expression_y / expression_x.
  • expression_y: First numeric expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.
  • expression_x: Second numeric expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.

atanh

Kind: Scalar.
Returns the area hyperbolic tangent or inverse hyperbolic tangent of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

cbrt

Kind: Scalar.
Returns the cube root of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

ceil

Kind: Scalar.
Returns the nearest integer greater than or equal to a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

cos

Kind: Scalar.
Returns the cosine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

cosh

Kind: Scalar.
Returns the hyperbolic cosine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

cot

Kind: Scalar.
Returns the cotangent of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

degrees

Kind: Scalar.
Converts radians to degrees.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

exp

Kind: Scalar.
Returns the base-e exponential of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

factorial

Kind: Scalar.
Factorial of a non-negative integer. Errors if the argument is negative or the result overflows.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

floor

Kind: Scalar.
Returns the nearest integer less than or equal to a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

gcd

Kind: Scalar.
Returns the greatest common divisor of expression_x and expression_y. Returns 0 if both inputs are zero.
  • expression_x: First numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_y: Second numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

isnan

Kind: Scalar.
Returns true if a given number is +NaN or -NaN otherwise returns false.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

iszero

Kind: Scalar.
Returns true if a given number is +0.0 or -0.0 otherwise returns false.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

lcm

Kind: Scalar.
Returns the least common multiple of expression_x and expression_y. Returns 0 if either input is zero.
  • expression_x: First numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_y: Second numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

ln

Kind: Scalar.
Returns the natural logarithm of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

log

Kind: Scalar.
Returns the base-x logarithm of a number. Can either provide a specified base, or if omitted then takes the base-10 of a number.
  • base: Base numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

log10

Kind: Scalar.
Returns the base-10 logarithm of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

log2

Kind: Scalar.
Returns the base-2 logarithm of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

nanvl

Kind: Scalar.
Returns the first argument if it’s not NaN. Returns the second argument otherwise.
  • expression_x: Numeric expression to return if it’s not NaN. Can be a constant, column, or function, and any combination of arithmetic operators.
  • expression_y: Numeric expression to return if the first expression is NaN. Can be a constant, column, or function, and any combination of arithmetic operators.

pi

Kind: Scalar.
Returns an approximate value of π.

power

Kind: Scalar. Aliases: pow.
Returns a base expression raised to the power of an exponent.
  • base: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • exponent: Exponent numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

radians

Kind: Scalar.
Converts degrees to radians.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

random

Kind: Scalar. Aliases: rand.
Returns a random float value in the range [0, 1). The random seed is unique to each row.

round

Kind: Scalar.
Rounds a number to the nearest integer.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • decimal_places: Optional. The number of decimal places to round to. Defaults to 0.

signum

Kind: Scalar.
Returns the sign of a number. Negative numbers return -1. Zero and positive numbers return 1.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

sin

Kind: Scalar.
Returns the sine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

sinh

Kind: Scalar.
Returns the hyperbolic sine of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

sqrt

Kind: Scalar.
Returns the square root of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

tan

Kind: Scalar.
Returns the tangent of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

tanh

Kind: Scalar.
Returns the hyperbolic tangent of a number.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

trunc

Kind: Scalar.
Truncates a number to a whole number or truncated to the specified decimal places.
  • numeric_expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • decimal_places: Optional. The number of decimal places to truncate to. Defaults to 0 (truncate to a whole number). If decimal_places is a positive integer, truncates digits to the right of the decimal point. If decimal_places is a negative integer, replaces digits to the left of the decimal point with 0.

Approximate Functions

approx_distinct

Kind: Aggregate.
Returns the approximate number of distinct input values calculated using the HyperLogLog algorithm.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

approx_median

Kind: Aggregate.
Returns the approximate median (50th percentile) of input values. It is an alias of approx_percentile_cont(0.5) WITHIN GROUP (ORDER BY x).
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

approx_percentile_cont

Kind: Aggregate.
Returns the approximate percentile of input values using the t-digest algorithm.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • percentile: Percentile to compute. Must be a float value between 0 and 1 (inclusive).
  • centroids: Number of centroids to use in the t-digest algorithm. Default is 100. A higher number results in more accurate approximation but requires more memory.

approx_percentile_cont_with_weight

Kind: Aggregate.
Returns the weighted approximate percentile of input values using the t-digest algorithm.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • weight: Expression to use as weight. Can be a constant, column, or function, and any combination of arithmetic operators.
  • percentile: Percentile to compute. Must be a float value between 0 and 1 (inclusive).
  • centroids: Number of centroids to use in the t-digest algorithm. Default is 100. A higher number results in more accurate approximation but requires more memory.

General Functions

array_agg

Kind: Aggregate.
Returns an array created from the expression elements. If ordering is required, elements are inserted in the specified order. This aggregation function can only mix DISTINCT and ORDER BY if the ordering expression is exactly the same as the argument expression.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

avg

Kind: Aggregate. Aliases: mean.
Returns the average of numeric values in the specified column.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

bit_and

Kind: Aggregate.
Computes the bitwise AND of all non-null input values.
  • expression: Integer expression to operate on. Can be a constant, column, or function, and any combination of operators.

bit_or

Kind: Aggregate.
Computes the bitwise OR of all non-null input values.
  • expression: Integer expression to operate on. Can be a constant, column, or function, and any combination of operators.

bit_xor

Kind: Aggregate.
Computes the bitwise exclusive OR of all non-null input values.
  • expression: Integer expression to operate on. Can be a constant, column, or function, and any combination of operators.

bool_and

Kind: Aggregate. Aliases: every.
Returns true if all non-null input values are true, otherwise false.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

bool_or

Kind: Aggregate. Aliases: any, some.
Returns true if all non-null input values are true, otherwise false.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

count

Kind: Aggregate.
Returns the number of non-null values in the specified column. To include null values in the total count, use count(*).
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

first_value

Kind: Aggregate. Aliases: first.
Returns the first element in an aggregation group according to the requested ordering. If no ordering is given, returns an arbitrary element from the group.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

grouping

Kind: Aggregate. Aliases: grouping_id.
Returns 1 if the data is aggregated across the specified column, or 0 if it is not aggregated in the result set.
  • expression: Expression to evaluate whether data is aggregated across the specified column. Can be a constant, column, or function.

last_value

Kind: Aggregate. Aliases: last.
Returns the last element in an aggregation group according to the requested ordering. If no ordering is given, returns an arbitrary element from the group.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

max

Kind: Aggregate.
Returns the maximum value in the specified column.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

median

Kind: Aggregate.
Returns the median value in the specified column.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

min

Kind: Aggregate.
Returns the minimum value in the specified column.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

percentile_cont

Kind: Aggregate. Aliases: quantile_cont.
Returns the exact percentile of input values, interpolating between values if needed.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • percentile: Percentile to compute. Must be a float value between 0 and 1 (inclusive).

string_agg

Kind: Aggregate.
Concatenates the values of string expressions and places separator values between them. If ordering is required, strings are concatenated in the specified order. This aggregation function can only mix DISTINCT and ORDER BY if the ordering expression is exactly the same as the first argument expression.
  • expression: The string expression to concatenate. Can be a column or any valid string expression.
  • delimiter: A literal string used as a separator between the concatenated values.

sum

Kind: Aggregate.
Returns the sum of all values in the specified column.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

var

Kind: Aggregate. Aliases: var_samp, var_sample.
Returns the statistical sample variance of a set of numbers.
  • expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

var_pop

Kind: Aggregate. Aliases: var_population.
Returns the statistical population variance of a set of numbers.
  • expression: Numeric expression to operate on. Can be a constant, column, or function, and any combination of operators.

Array Functions

array_any_match

Kind: Higher order. Aliases: any_match, exists, list_any_match.
Returns whether any elements of an array match the given predicate. Returns true if one or more elements match, false if none match (including empty arrays), and null if the predicate returns null for some elements and false for all others.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • predicate: Lambda predicate that returns a boolean

array_any_value

Kind: Scalar. Aliases: list_any_value.
Returns the first non-null element in the array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_append

Kind: Scalar. Aliases: array_push_back, list_append, list_push_back.
Appends an element to the end of an array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Element to append to the array.

array_compact

Kind: Scalar. Aliases: list_compact.
Removes null values from the array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_concat

Kind: Scalar. Aliases: array_cat, list_cat, list_concat.
Concatenates arrays.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array_n: Subsequent array column or literal array to concatenate.

array_dims

Kind: Scalar. Aliases: list_dims.
Returns an array of the array’s dimensions.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_distance

Kind: Scalar. Aliases: list_distance.
Returns the Euclidean distance between two input arrays of equal length.
  • array1: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array2: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_distinct

Kind: Scalar. Aliases: list_distinct.
Returns distinct values from the array after removing duplicates.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_element

Kind: Scalar. Aliases: array_extract, list_element, list_extract.
Extracts the element with the index n from the array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • index: Index to extract the element from the array.

array_except

Kind: Scalar. Aliases: list_except.
Returns an array of the elements that appear in the first array but not in the second.
  • array1: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array2: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_filter

Kind: Higher order. Aliases: filter, list_filter.
filters the values of an array using a boolean lambda
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • lambda: Lambda that returns a boolean. Elements for which the lambda returns true are kept.

array_has

Kind: Scalar. Aliases: array_contains, list_contains, list_has.
Returns true if the array contains the element.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Scalar or Array expression. Can be a constant, column, or function, and any combination of array operators.

array_has_all

Kind: Scalar. Aliases: list_has_all.
Returns true if all elements of sub-array exist in array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • sub-array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_has_any

Kind: Scalar. Aliases: arrays_overlap, list_has_any.
Returns true if the arrays have any elements in common.
  • array1: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array2: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_intersect

Kind: Scalar. Aliases: list_intersect.
Returns an array of elements in the intersection of array1 and array2.
  • array1: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array2: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_length

Kind: Scalar. Aliases: list_length.
Returns the length of the array dimension.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • dimension: Array dimension.

array_max

Kind: Scalar. Aliases: list_max.
Returns the maximum value in the array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_min

Kind: Scalar.
Returns the minimum value in the array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_ndims

Kind: Scalar. Aliases: list_ndims.
Returns the number of dimensions of the array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Array element.

array_normalize

Kind: Scalar. Aliases: list_normalize.
Returns the L2-normalized vector for the input numeric array, computed as array[i] / sqrt(sum(array[i]^2)) per element. Returns NULL if the input is NULL, contains NULL elements, or has zero magnitude (all elements are zero). Returns an empty array for an empty input array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_pop_back

Kind: Scalar. Aliases: list_pop_back.
Returns the array without the last element.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_pop_front

Kind: Scalar. Aliases: list_pop_front.
Returns the array without the first element.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_position

Kind: Scalar. Aliases: array_indexof, list_indexof, list_position.
Returns the position of the first occurrence of the specified element in the array, or NULL if not found. Comparisons are done using IS DISTINCT FROM semantics, so NULL is considered to match NULL.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Element to search for in the array.
  • index: Index at which to start searching (1-indexed).

array_positions

Kind: Scalar. Aliases: list_positions.
Searches for an element in the array, returns all occurrences.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Element to search for in the array.

array_prepend

Kind: Scalar. Aliases: array_push_front, list_prepend, list_push_front.
Prepends an element to the beginning of an array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Element to prepend to the array.

array_remove

Kind: Scalar. Aliases: list_remove.
Removes the first element from the array equal to the given value. NULL elements already in the array are preserved when removing a non-NULL value. If element evaluates to NULL, the result is NULL rather than removing NULL entries.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Element to be removed from the array.

array_remove_all

Kind: Scalar. Aliases: list_remove_all.
Removes all elements from the array equal to the given value. NULL elements already in the array are preserved when removing a non-NULL value. If element evaluates to NULL, the result is NULL rather than removing NULL entries.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Element to be removed from the array.

array_remove_n

Kind: Scalar. Aliases: list_remove_n.
Removes the first max elements from the array equal to the given value. NULL elements already in the array are preserved when removing a non-NULL value. If element evaluates to NULL, the result is NULL rather than removing NULL entries.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • element: Element to be removed from the array.
  • max: Number of first occurrences to remove.

array_repeat

Kind: Scalar. Aliases: list_repeat.
Returns an array containing element count times.
  • element: Element expression. Can be a constant, column, or function, and any combination of array operators.
  • count: Value of how many times to repeat the element.

array_replace

Kind: Scalar. Aliases: list_replace.
Replaces the first occurrence of the specified element with another specified element.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • from: Initial element.
  • to: Final element.

array_replace_all

Kind: Scalar. Aliases: list_replace_all.
Replaces all occurrences of the specified element with another specified element.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • from: Initial element.
  • to: Final element.

array_replace_n

Kind: Scalar. Aliases: list_replace_n.
Replaces the first max occurrences of the specified element with another specified element.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • from: Initial element.
  • to: Final element.
  • max: Number of first occurrences to replace.

array_resize

Kind: Scalar. Aliases: list_resize.
Resizes the list to contain size elements. Initializes new elements with value or empty if value is not set.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • size: New size of given array.
  • value: Defines new elements’ value or empty if value is not set.

array_reverse

Kind: Scalar. Aliases: list_reverse.
Returns the array with the order of the elements reversed.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

array_slice

Kind: Scalar. Aliases: list_slice.
Returns a slice of the array based on 1-indexed start and end positions.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • begin: Index of the first element. If negative, it counts backward from the end of the array.
  • end: Index of the last element. If negative, it counts backward from the end of the array.
  • stride: Stride of the array slice. The default is 1.

array_sort

Kind: Scalar. Aliases: list_sort.
Sort array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • desc: Whether to sort in ascending (ASC) or descending (DESC) order. The default is ASC.
  • nulls_first: Whether to sort nulls first (NULLS FIRST) or last (NULLS LAST). The default is NULLS FIRST.

array_to_string

Kind: Scalar. Aliases: array_join, list_join, list_to_string.
Converts each element to its text representation.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • delimiter: Array element separator.
  • null_string: Optional. String to use for null values in the output. If not provided, nulls will be omitted.

array_transform

Kind: Higher order. Aliases: list_transform, transform.
transforms the values of an array
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • lambda: Lambda

array_union

Kind: Scalar. Aliases: list_union.
Returns an array of elements that are present in both arrays (all elements from both arrays) without duplicates.
  • array1: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array2: Array expression. Can be a constant, column, or function, and any combination of array operators.

arrays_zip

Kind: Scalar. Aliases: list_zip.
Returns an array of structs created by combining the elements of each input array at the same index. If the arrays have different lengths, shorter arrays are padded with NULLs.
  • array1: First array expression.
  • array_n: Optional additional array expressions.

cardinality

Kind: Scalar.
Returns the total number of elements in the array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

cosine_distance

Kind: Scalar.
Returns the cosine distance between two input arrays of equal length. The cosine distance is defined as 1 - cosine_similarity, i.e. 1 - dot(a,b) / (||a|| * ||b||). Returns NULL if either array is NULL or contains only zeros.
  • array1: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array2: Array expression. Can be a constant, column, or function, and any combination of array operators.

empty

Kind: Scalar. Aliases: array_empty, list_empty.
Returns 1 for an empty array or 0 for a non-empty array.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

flatten

Kind: Scalar.
Converts an array of arrays to a flat array.
  • Applies to any depth of nested arrays
  • Does not change arrays that are already flat
The flattened array contains all the elements from all source arrays.
  • array: Array expression. Can be a constant, column, or function, and any combination of array operators.

generate_series

Kind: Scalar.
Similar to the range function, but it includes the upper bound.
  • start: Start of the series. Ints, timestamps, dates or string types that can be coerced to Date32 are supported.
  • end: End of the series (included). Type must be the same as start.
  • step: Increase by step (can not be 0). Steps less than a day are supported only for timestamp ranges.

inner_product

Kind: Scalar. Aliases: dot_product.
Returns the inner product (dot product) of two input arrays of equal length, computed as sum(array1[i] * array2[i]). Returns NULL if either array is NULL or contains NULL elements. Returns 0.0 for two empty arrays.
  • array1: Array expression. Can be a constant, column, or function, and any combination of array operators.
  • array2: Array expression. Can be a constant, column, or function, and any combination of array operators.

make_array

Kind: Scalar. Aliases: array, make_list.
Returns an array using the specified input expressions.
  • expression_n: Expression to include in the output array. Can be a constant, column, or function, and any combination of arithmetic or string operators.

range

Kind: Scalar.
Returns an Arrow array between start and stop with step. The range start..end contains all values with start <= x < end. It is empty if start >= end. Step cannot be 0.
  • start: Start of the range. Ints, timestamps, dates or string types that can be coerced to Date32 are supported.
  • end: End of the range (not included). Type must be the same as start.
  • step: Increase by step (cannot be 0). Steps less than a day are supported only for timestamp ranges.

string_to_array

Kind: Scalar. Aliases: string_to_list.
Splits a string into an array of substrings based on a delimiter. Any substrings matching the optional null_str argument are replaced with NULL.
  • str: String expression to split.
  • delimiter: Delimiter string to split on.
  • null_str: Substring values to be replaced with NULL.

Other Functions

arrow_cast

Kind: Scalar.
Casts a value to a specific Arrow data type.
  • expression: Expression to cast. The expression can be a constant, column, or function, and any combination of operators.
  • datatype: Arrow data type name to cast to, as a string. The format is the same as that returned by [arrow_typeof]

arrow_field

Kind: Scalar.
Returns a struct containing the Arrow field information of the expression, including name, data type, nullability, and metadata.
  • expression: Expression to evaluate. The expression can be a constant, column, or function, and any combination of operators.

arrow_metadata

Kind: Scalar.
Returns the metadata of the input expression. If a key is provided, returns the value for that key. If no key is provided, returns a Map of all metadata.
  • expression: The expression to retrieve metadata from. Can be a column or other expression.
  • key: Optional. The specific metadata key to retrieve.

arrow_try_cast

Kind: Scalar.
Casts a value to a specific Arrow data type, returning NULL if the cast fails.
  • expression: Expression to cast. The expression can be a constant, column, or function, and any combination of operators.
  • datatype: Arrow data type name to cast to, as a string. The format is the same as that returned by [arrow_typeof]

arrow_typeof

Kind: Scalar.
Returns the name of the underlying Arrow data type of the expression.
  • expression: Expression to evaluate. The expression can be a constant, column, or function, and any combination of operators.

cast_to_type

Kind: Scalar.
Casts the first argument to the data type of the second argument. Only the type of the second argument is used; its value is ignored.
  • expression: The expression to cast. It can be a constant, column, or function, and any combination of operators.
  • reference: Reference expression whose data type determines the target cast type. The value is ignored.

get_field

Kind: Scalar. Aliases: getfield.
Returns a field within a map or a struct with the given key. Supports nested field access by providing multiple field names. Note: most users invoke get_field indirectly via field access syntax such as my_struct_col['field_name'] which results in a call to get_field(my_struct_col, 'field_name'). Nested access like my_struct['a']['b'] is optimized to a single call: get_field(my_struct, 'a', 'b').
  • expression: The map or struct to retrieve a field from.
  • field_name: The field name(s) to access, in order for nested access. Must evaluate to strings.

try_cast_to_type

Kind: Scalar.
Casts the first argument to the data type of the second argument, returning NULL if the cast fails. Only the type of the second argument is used; its value is ignored.
  • expression: The expression to cast. It can be a constant, column, or function, and any combination of operators.
  • reference: Reference expression whose data type determines the target cast type. The value is ignored.

version

Kind: Scalar.
Returns the version of DataFusion.

with_metadata

Kind: Scalar.
Attaches Arrow field metadata (key/value pairs) to the input expression. Keys must be non-empty constant strings and values must be constant strings (empty values are allowed). Existing metadata on the input field is preserved; new keys overwrite on collision. This is the inverse of arrow_metadata.
  • expression: The expression whose output Arrow field should be annotated. Values flow through unchanged.
  • key: Metadata key. Must be a non-empty constant string literal.
  • value: Metadata value. Must be a constant string literal (may be empty).

String Functions

ascii

Kind: Scalar.
Returns the first Unicode scalar value of a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

bit_length

Kind: Scalar.
Returns the bit length of a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

btrim

Kind: Scalar. Aliases: trim.
Trims the specified trim string from the start and end of a string. If no trim string is provided, all spaces are removed from the start and end of the input string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • trim_str: String expression to operate on. Can be a constant, column, or function, and any combination of operators. Default is a space.

character_length

Kind: Scalar. Aliases: char_length, length.
Returns the number of characters in a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

chr

Kind: Scalar.
Returns a string containing the character with the specified Unicode scalar value.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

concat

Kind: Scalar.
Concatenates multiple strings together.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • str_n: Subsequent string expressions to concatenate.

concat_ws

Kind: Scalar.
Concatenates multiple strings together with a specified separator.
  • separator: Separator to insert between concatenated strings.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • str_n: Subsequent string expressions to concatenate.

contains

Kind: Scalar.
Return true if search_str is found within string (case-sensitive).
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • search_str: The string to search for in str.

ends_with

Kind: Scalar.
Tests if a string ends with a substring.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • substr: Substring to test for.

find_in_set

Kind: Scalar.
Returns a value in the range of 1 to N if the string str is in the string list strlist consisting of N substrings.
  • str: String expression to find in strlist.
  • strlist: A string list is a string composed of substrings separated by , characters.

initcap

Kind: Scalar.
Capitalizes the first character in each word in the input string. Words are delimited by non-alphanumeric characters.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

left

Kind: Scalar.
Returns a specified number of characters from the left side of a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • n: Number of characters to return.

levenshtein

Kind: Scalar.
Returns the Levenshtein distance between the two given strings.
  • str1: String expression to compute Levenshtein distance with str2.
  • str2: String expression to compute Levenshtein distance with str1.

lower

Kind: Scalar. Aliases: lcase.
Converts a string to lower-case.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

lpad

Kind: Scalar.
Pads the left side of a string with another string to a specified string length.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • n: String length to pad to. If the input string is longer than this length, it is truncated (on the right).
  • padding_str: Optional string expression to pad with. Can be a constant, column, or function, and any combination of string operators. Default is a space.

ltrim

Kind: Scalar.
Trims the specified trim string from the beginning of a string. If no trim string is provided, spaces are removed from the start of the input string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • trim_str: String expression to trim from the beginning of the input string. Can be a constant, column, or function, and any combination of arithmetic operators. Default is a space.

octet_length

Kind: Scalar.
Returns the length of a string in bytes.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

overlay

Kind: Scalar.
Returns the string which is replaced by another string from the specified position and specified count length.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • substr: Substring to replace in str.
  • pos: The start position to start the replace in str.
  • count: The count of characters to be replaced from start position of str. If not specified, will use substr length instead.

repeat

Kind: Scalar.
Returns a string with an input string repeated a specified number.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • n: Number of times to repeat the input string.

replace

Kind: Scalar.
Replaces all occurrences of a specified substring in a string with a new substring.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • substr: Substring expression to replace in the input string. Substring expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • replacement: Replacement substring expression to operate on. Can be a constant, column, or function, and any combination of operators.

reverse

Kind: Scalar.
Reverses the character order of a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
Kind: Scalar.
Returns a specified number of characters from the right side of a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • n: Number of characters to return.

rpad

Kind: Scalar.
Pads the right side of a string with another string to a specified string length.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • n: String length to pad to. If the input string is longer than this length, it is truncated.
  • padding_str: String expression to pad with. Can be a constant, column, or function, and any combination of string operators. Default is a space.

rtrim

Kind: Scalar.
Trims the specified trim string from the end of a string. If no trim string is provided, all spaces are removed from the end of the input string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • trim_str: String expression to trim from the end of the input string. Can be a constant, column, or function, and any combination of arithmetic operators. Default is a space.

split_part

Kind: Scalar.
Splits a string based on a specified delimiter and returns the substring in the specified position.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • delimiter: String or character to split on.
  • pos: Position of the part to return (counting from 1). Negative values count backward from the end of the string.

starts_with

Kind: Scalar.
Tests if a string starts with a substring.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • substr: Substring to test for.

strpos

Kind: Scalar. Aliases: instr, position.
Returns the starting position of a specified substring in a string. Positions begin at 1. If the substring does not exist in the string, the function returns 0.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • substr: Substring expression to search for.

substr

Kind: Scalar. Aliases: substring.
Extracts a substring of a specified number of characters from a specific starting position in a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • start_pos: Character position to start the substring at. The first character in the string has a position of 1. If the start position is less than 1, it is treated as if it is before the start of the string and the (absolute) number of characters before position 1 is subtracted from length (if given). For example, substr('abc', -3, 6) returns 'ab'.
  • length: Number of characters to extract. If not specified, returns the rest of the string after the start position.

substr_index

Kind: Scalar. Aliases: substring_index.
Returns the substring from str before count occurrences of the delimiter delim. If count is positive, everything to the left of the final delimiter (counting from the left) is returned. If count is negative, everything to the right of the final delimiter (counting from the right) is returned.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • delim: The string to find in str to split str.
  • count: The number of times to search for the delimiter. Can be either a positive or negative number.

to_hex

Kind: Scalar.
Converts an integer to a hexadecimal string.
  • int: Integer expression to operate on. Can be a constant, column, or function, and any combination of operators.

translate

Kind: Scalar.
Performs character-wise substitution based on a mapping.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • from: The characters to be replaced.
  • to: The characters to replace them with. Each character in from that is found in str is replaced by the character at the same index in to. Any characters in from that don’t have a corresponding character in to are removed. If a character appears more than once in from, the first occurrence determines the mapping.

upper

Kind: Scalar. Aliases: ucase.
Converts a string to upper-case.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

uuid

Kind: Scalar.
Returns UUID v4 string value which is unique per row.

Conditional Functions

coalesce

Kind: Scalar. Aliases: ifnull, nvl.
Returns the first of its arguments that is not null. Returns null if all arguments are null. This function is often used to substitute a default value for null values.
  • expression1, expression_n: Expression to use if previous expressions are null. Can be a constant, column, or function, and any combination of arithmetic operators. Pass as many expression arguments as necessary.

greatest

Kind: Scalar.
Returns the greatest value in a list of expressions. Returns null if all expressions are null.
  • expression1, expression_n: Expressions to compare and return the greatest value.. Can be a constant, column, or function, and any combination of arithmetic operators. Pass as many expression arguments as necessary.

least

Kind: Scalar.
Returns the smallest value in a list of expressions. Returns null if all expressions are null.
  • expression1, expression_n: Expressions to compare and return the smallest value. Can be a constant, column, or function, and any combination of arithmetic operators. Pass as many expression arguments as necessary.

nullif

Kind: Scalar.
Returns null if expression1 equals expression2; otherwise it returns expression1. This can be used to perform the inverse operation of coalesce.
  • expression1: Expression to compare and return if equal to expression2. Can be a constant, column, or function, and any combination of operators.
  • expression2: Expression to compare to expression1. Can be a constant, column, or function, and any combination of operators.

nvl

Kind: Scalar. Aliases: ifnull.
Returns expression2 if expression1 is NULL otherwise it returns expression1 and expression2 is not evaluated. This function can be used to substitute a default value for NULL values.
  • expression1: Expression to return if not null. Can be a constant, column, or function, and any combination of operators.
  • expression2: Expression to return if expr1 is null. Can be a constant, column, or function, and any combination of operators.

nvl2

Kind: Scalar.
Returns expression2 if expression1 is not NULL; otherwise it returns expression3.
  • expression1: Expression to test for null. Can be a constant, column, or function, and any combination of operators.
  • expression2: Expression to return if expr1 is not null. Can be a constant, column, or function, and any combination of operators.
  • expression3: Expression to return if expr1 is null. Can be a constant, column, or function, and any combination of operators.

Statistical Functions

corr

Kind: Aggregate.
Returns the coefficient of correlation between two numeric values.
  • expression1: First expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression2: Second expression to operate on. Can be a constant, column, or function, and any combination of operators.

covar_pop

Kind: Aggregate.
Returns the sample covariance of a set of number pairs.
  • expression1: First expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression2: Second expression to operate on. Can be a constant, column, or function, and any combination of operators.

covar_samp

Kind: Aggregate. Aliases: covar.
Returns the sample covariance of a set of number pairs.
  • expression1: First expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression2: Second expression to operate on. Can be a constant, column, or function, and any combination of operators.

nth_value

Kind: Aggregate.
Returns the nth value in a group of values.
  • expression: The column or expression to retrieve the nth value from.
  • n: The position (nth) of the value to retrieve, based on the ordering.

regr_avgx

Kind: Aggregate.
Computes the average of the independent variable (input) expression_x for the non-null paired data points.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_avgy

Kind: Aggregate.
Computes the average of the dependent variable (output) expression_y for the non-null paired data points.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_count

Kind: Aggregate.
Counts the number of non-null paired data points.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_intercept

Kind: Aggregate.
Computes the y-intercept of the linear regression line. For the equation (y = kx + b), this function returns b.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_r2

Kind: Aggregate.
Computes the square of the correlation coefficient between the independent and dependent variables.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_slope

Kind: Aggregate.
Returns the slope of the linear regression line for non-null pairs in aggregate columns. Given input column Y and X: regr_slope(Y, X) returns the slope (k in Y = k*X + b) using minimal RSS fitting.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_sxx

Kind: Aggregate.
Computes the sum of squares of the independent variable.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_sxy

Kind: Aggregate.
Computes the sum of products of paired data points.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

regr_syy

Kind: Aggregate.
Computes the sum of squares of the dependent variable.
  • expression_y: Dependent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • expression_x: Independent variable expression to operate on. Can be a constant, column, or function, and any combination of operators.

stddev

Kind: Aggregate. Aliases: std, stddev_samp.
Returns the standard deviation of a set of numbers.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

stddev_pop

Kind: Aggregate.
Returns the population standard deviation of a set of numbers.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.

Ranking Functions

cume_dist

Kind: Window.
Relative rank of the current row: (number of rows preceding or peer with the current row) / (total rows).

dense_rank

Kind: Window.
Returns the rank of the current row without gaps. This function ranks rows in a dense manner, meaning consecutive ranks are assigned even for identical values.

ntile

Kind: Window.
Integer ranging from 1 to the argument value, dividing the partition as equally as possible
  • expression: An integer describing the number groups the partition should be split into

percent_rank

Kind: Window.
Returns the percentage rank of the current row within its partition. The value ranges from 0 to 1 and is computed as (rank - 1) / (total_rows - 1).

rank

Kind: Window.
Returns the rank of the current row within its partition, allowing gaps between ranks. This function provides a ranking similar to row_number, but skips ranks for identical values.

row_number

Kind: Window.
Number of the current row within its partition, counting from 1.

Time and Date Functions

current_date

Kind: Scalar. Aliases: today.
Returns the current date in the session time zone. The current_date() return value is determined at query time and will return the same date, no matter when in the query plan the function executes.

current_time

Kind: Scalar.
Returns the current time in the session time zone. The current_time() return value is determined at query time and will return the same time, no matter when in the query plan the function executes. The session time zone can be set using the statement ‘SET datafusion.execution.time_zone = desired time zone’. The time zone can be a value like +00:00, ‘Europe/London’ etc.

date_bin

Kind: Scalar.
Calculates time intervals and returns the start of the interval nearest to the specified timestamp. Use date_bin to downsample time series data by grouping rows into time-based “bins” or “windows” and applying an aggregate or selector function to each window. For example, if you “bin” or “window” data into 15 minute intervals, an input timestamp of 2023-01-01T18:18:18Z will be updated to the start time of the 15 minute bin it is in: 2023-01-01T18:15:00Z.
  • interval: Bin interval.
  • expression: Time expression to operate on. Can be a constant, column, or function.
  • origin-timestamp: Optional. Starting point used to determine bin boundaries. If not specified defaults 1970-01-01T00:00:00Z (the UNIX epoch in UTC). The following intervals are supported:
    • nanoseconds
    • microseconds
    • milliseconds
    • seconds
    • minutes
    • hours
    • days
    • weeks
    • months
    • years
    • century

date_part

Kind: Scalar. Aliases: datepart.
Returns the specified part of the date as an integer.
  • part: Part of the date to return. The following date parts are supported:
    • year
    • isoyear (ISO 8601 week-numbering year)
    • quarter (emits value in inclusive range [1, 4] based on which quartile of the year the date is in)
    • month
    • week (week of the year)
    • day (day of the month)
    • hour
    • minute
    • second
    • millisecond
    • microsecond
    • nanosecond
    • dow (day of the week where Sunday is 0)
    • doy (day of the year)
    • epoch (seconds since Unix epoch for timestamps/dates, total seconds for intervals)
    • isodow (ISO 8601 day of the week where Monday is 1 and Sunday is 7)
  • expression: Time expression to operate on. Can be a constant, column, or function.

date_trunc

Kind: Scalar. Aliases: datetrunc.
Truncates a timestamp or time value to a specified precision.
  • precision: Time precision to truncate to. The following precisions are supported: For Timestamp types:
    • year / YEAR
    • quarter / QUARTER
    • month / MONTH
    • week / WEEK
    • day / DAY
    • hour / HOUR
    • minute / MINUTE
    • second / SECOND
    • millisecond / MILLISECOND
    • microsecond / MICROSECOND
    For Time types (hour, minute, second, millisecond, microsecond only):
    • hour / HOUR
    • minute / MINUTE
    • second / SECOND
    • millisecond / MILLISECOND
    • microsecond / MICROSECOND
  • expression: Timestamp or time expression to operate on. Can be a constant, column, or function.

from_unixtime

Kind: Scalar.
Converts an integer to RFC3339 timestamp format (YYYY-MM-DDT00:00:00.000000000Z). Integers and unsigned integers are interpreted as seconds since the unix epoch (1970-01-01T00:00:00Z) return the corresponding timestamp.
  • expression: The expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • timezone: Optional timezone to use when converting the integer to a timestamp. If not provided, the default timezone is UTC.

make_date

Kind: Scalar.
Make a date from year/month/day component parts.
  • year: Year to use when making the date. Can be a constant, column or function, and any combination of arithmetic operators.
  • month: Month to use when making the date. Can be a constant, column or function, and any combination of arithmetic operators.
  • day: Day to use when making the date. Can be a constant, column or function, and any combination of arithmetic operators.

make_time

Kind: Scalar.
Make a time from hour/minute/second component parts.
  • hour: Hour to use when making the time. Can be a constant, column or function, and any combination of arithmetic operators.
  • minute: Minute to use when making the time. Can be a constant, column or function, and any combination of arithmetic operators.
  • second: Second to use when making the time. Can be a constant, column or function, and any combination of arithmetic operators.

now

Kind: Scalar. Aliases: current_timestamp.
Returns the current timestamp in the system configured timezone (None by default). The now() return value is determined at query time and will return the same timestamp, no matter when in the query plan the function executes.

to_char

Kind: Scalar. Aliases: date_format.
Returns a string representation of a date, time, timestamp or duration based on a Chrono format. Unlike the PostgreSQL equivalent of this function numerical formatting is not supported.
  • expression: Expression to operate on. Can be a constant, column, or function that results in a date, time, timestamp or duration.
  • format: A Chrono format string to use to convert the expression.
  • day: Day to use when making the date. Can be a constant, column or function, and any combination of arithmetic operators.

to_date

Kind: Scalar.
Converts a value to a date (YYYY-MM-DD). Supports strings, numeric and timestamp types as input. Strings are parsed as YYYY-MM-DD (e.g. ‘2023-07-20’) if no Chrono formats are provided. Integers and doubles are interpreted as days since the unix epoch (1970-01-01T00:00:00Z). Returns the corresponding date. Note: to_date returns Date32, which represents its values as the number of days since unix epoch(1970-01-01) stored as signed 32 bit value. The largest supported date value is 9999-12-31.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned.

to_local_time

Kind: Scalar.
Converts a timestamp with a timezone to a timestamp without a timezone (with no offset or timezone information). This function handles daylight saving time changes.
  • expression: Time expression to operate on. Can be a constant, column, or function.

to_time

Kind: Scalar.
Converts a value to a time (HH:MM:SS.nnnnnnnnn). Supports strings and timestamps as input. Strings are parsed as HH:MM:SS, HH:MM:SS.nnnnnnnnn, or HH:MM if no Chrono formats are provided. Timestamps will have the time portion extracted. Returns the corresponding time. Note: to_time returns Time64(Nanosecond), which represents the time of day in nanoseconds since midnight.
  • expression: String or Timestamp expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned.

to_timestamp

Kind: Scalar.
Converts a value to a timestamp (YYYY-MM-DDT00:00:00.000000<TZ>) in the session time zone. Supports strings, integer, unsigned integer, and double types as input. Strings are parsed as RFC3339 (e.g. ‘2023-07-20T05:44:00’) if no Chrono formats are provided. Strings that parse without a time zone are treated as if they are in the session time zone, or UTC if no session time zone is set. Integers, unsigned integers, and doubles are interpreted as seconds since the unix epoch (1970-01-01T00:00:00Z). Note: to_timestamp returns Timestamp(ns, TimeZone) where the time zone is the session time zone. The supported range for integer input is between-9223372037 and 9223372036. Supported range for string input is between 1677-09-21T00:12:44.0 and 2262-04-11T23:47:16.0. Please use to_timestamp_seconds for the input outside of supported bounds. The session time zone can be set using the statement SET TIMEZONE = 'desired time zone'. The time zone can be a value like +00:00, ‘Europe/London’ etc.
  • expression: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned. Note: parsing of named timezones (e.g. ‘America/New_York’) using %Z is only supported at the end of the string preceded by a space.

to_timestamp_micros

Kind: Scalar.
Converts a value to a timestamp (YYYY-MM-DDT00:00:00.000000<TZ>) in the session time zone. Supports strings, integer, unsigned integer, and double types as input. Strings are parsed as RFC3339 (e.g. ‘2023-07-20T05:44:00’) if no Chrono formats are provided. Strings that parse without a time zone are treated as if they are in the session time zone, or UTC if no session time zone is set. Integers, unsigned integers, and doubles are interpreted as microseconds since the unix epoch (1970-01-01T00:00:00Z). The session time zone can be set using the statement SET TIMEZONE = 'desired time zone'. The time zone can be a value like +00:00, ‘Europe/London’ etc.
  • expression: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned. Note: parsing of named timezones (e.g. ‘America/New_York’) using %Z is only supported at the end of the string preceded by a space.

to_timestamp_millis

Kind: Scalar.
Converts a value to a timestamp (YYYY-MM-DDT00:00:00.000<TZ>) in the session time zone. Supports strings, integer, unsigned integer, and double types as input. Strings are parsed as RFC3339 (e.g. ‘2023-07-20T05:44:00’) if no Chrono formats are provided. Strings that parse without a time zone are treated as if they are in the session time zone, or UTC if no session time zone is set. Integers, unsigned integers, and doubles are interpreted as milliseconds since the unix epoch (1970-01-01T00:00:00Z). The session time zone can be set using the statement SET TIMEZONE = 'desired time zone'. The time zone can be a value like +00:00, ‘Europe/London’ etc.
  • expression: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned. Note: parsing of named timezones (e.g. ‘America/New_York’) using %Z is only supported at the end of the string preceded by a space.

to_timestamp_nanos

Kind: Scalar.
Converts a value to a timestamp (YYYY-MM-DDT00:00:00.000000000<TZ>) in the session time zone. Supports strings, integer, unsigned integer, and double types as input. Strings are parsed as RFC3339 (e.g. ‘2023-07-20T05:44:00’) if no Chrono formats are provided. Strings that parse without a time zone are treated as if they are in the session time zone. Integers, unsigned integers, and doubles are interpreted as nanoseconds since the unix epoch (1970-01-01T00:00:00Z). The session time zone can be set using the statement SET TIMEZONE = 'desired time zone'. The time zone can be a value like +00:00, ‘Europe/London’ etc.
  • expression: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned. Note: parsing of named timezones (e.g. ‘America/New_York’) using %Z is only supported at the end of the string preceded by a space.

to_timestamp_seconds

Kind: Scalar.
Converts a value to a timestamp (YYYY-MM-DDT00:00:00<TZ>) in the session time zone. Supports strings, integer, unsigned integer, and double types as input. Strings are parsed as RFC3339 (e.g. ‘2023-07-20T05:44:00’) if no Chrono formats are provided. Strings that parse without a time zone are treated as if they are in the session time zone, or UTC if no session time zone is set. Integers, unsigned integers, and doubles are interpreted as seconds since the unix epoch (1970-01-01T00:00:00Z). The session time zone can be set using the statement SET TIMEZONE = 'desired time zone'. The time zone can be a value like +00:00, ‘Europe/London’ etc.
  • expression: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned. Note: parsing of named timezones (e.g. ‘America/New_York’) using %Z is only supported at the end of the string preceded by a space.

to_unixtime

Kind: Scalar.
Converts a value to seconds since the unix epoch (1970-01-01T00:00:00). Supports strings, dates, timestamps, integer, unsigned integer, and float types as input. Strings are parsed as RFC3339 (e.g. ‘2023-07-20T05:44:00’) if no Chrono formats are provided. Integers, unsigned integers, and floats are interpreted as seconds since the unix epoch (1970-01-01T00:00:00).
  • expression: Expression to operate on. Can be a constant, column, or function, and any combination of arithmetic operators.
  • format_n: Optional Chrono format strings to use to parse the expression. Formats will be tried in the order they appear with the first successful one being returned. If none of the formats successfully parse the expression an error will be returned.

Binary String Functions

decode

Kind: Scalar.
Decode binary data from textual representation in string.
  • expression: Expression containing encoded string data
  • format: Same arguments as encode

encode

Kind: Scalar.
Encode binary data into a textual representation.
  • expression: Expression containing string or binary data
  • format: Supported formats are: base64, base64pad, hex

Hashing Functions

digest

Kind: Scalar.
Computes the binary hash of an expression using the specified algorithm.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • algorithm: String expression specifying algorithm to use. Must be one of:
    • md5
    • sha224
    • sha256
    • sha384
    • sha512
    • blake2s
    • blake2b
    • blake3

md5

Kind: Scalar.
Computes an MD5 128-bit checksum for a string expression.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

sha224

Kind: Scalar.
Computes the SHA-224 hash of a binary string.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

sha256

Kind: Scalar.
Computes the SHA-256 hash of a binary string.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

sha384

Kind: Scalar.
Computes the SHA-384 hash of a binary string.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

sha512

Kind: Scalar.
Computes the SHA-512 hash of a binary string.
  • expression: String expression to operate on. Can be a constant, column, or function, and any combination of operators.

Analytical Functions

first_value

Kind: Window. Aliases: first.
Returns value evaluated at the row that is the first row of the window frame.
  • expression: Expression to operate on

lag

Kind: Window.
Returns value evaluated at the row that is offset rows before the current row within the partition; if there is no such row, instead return default (which must be of the same type as value).
  • expression: Expression to operate on
  • offset: Integer. Specifies how many rows back the value of expression should be retrieved. Defaults to 1.
  • default: The default value if the offset is not within the partition. Must be of the same type as expression.

last_value

Kind: Window. Aliases: last.
Returns value evaluated at the row that is the last row of the window frame.
  • expression: Expression to operate on

lead

Kind: Window.
Returns value evaluated at the row that is offset rows after the current row within the partition; if there is no such row, instead return default (which must be of the same type as value).
  • expression: Expression to operate on
  • offset: Integer. Specifies how many rows forward the value of expression should be retrieved. Defaults to 1.
  • default: The default value if the offset is not within the partition. Must be of the same type as expression.

nth_value

Kind: Window.
Returns the value evaluated at the nth row of the window frame (counting from 1). Returns NULL if no such row exists.
  • expression: The column from which to retrieve the nth value.
  • n: Integer. Specifies the row number (starting from 1) in the window frame.

Scalar

json_extract_string

Kind: Scalar.
No additional registry description.

Map Functions

map

Kind: Scalar.
Returns an Arrow map with the specified key-value pairs. The make_map function creates a map from two lists: one for keys and one for values. Each key must be unique and non-null.
  • key: For map: Expression to be used for key. Can be a constant, column, function, or any combination of arithmetic or string operators. For make_map: The list of keys to be used in the map. Each key must be unique and non-null.
  • value: For map: Expression to be used for value. Can be a constant, column, function, or any combination of arithmetic or string operators. For make_map: The list of values to be mapped to the corresponding keys.

map_entries

Kind: Scalar.
Returns a list of all entries in the map.
  • map: Map expression. Can be a constant, column, or function, and any combination of map operators.

map_extract

Kind: Scalar. Aliases: element_at.
Returns a list containing the value for the given key or an empty list if the key is not present in the map.
  • map: Map expression. Can be a constant, column, or function, and any combination of map operators.
  • key: Key to extract from the map. Can be a constant, column, or function, any combination of arithmetic or string operators, or a named expression of the previously listed.

map_keys

Kind: Scalar.
Returns a list of all keys in the map.
  • map: Map expression. Can be a constant, column, or function, and any combination of map operators.

map_values

Kind: Scalar.
Returns a list of all values in the map.
  • map: Map expression. Can be a constant, column, or function, and any combination of map operators.

Struct Functions

named_struct

Kind: Scalar.
Returns an Arrow struct using the specified name and input expressions pairs. For information on comparing and ordering struct values (including NULL handling), see Comparison and Ordering.
  • expression_n_name: Name of the column field. Must be a constant string.
  • expression_n_input: Expression to include in the output struct. Can be a constant, column, or function, and any combination of arithmetic or string operators.

struct

Kind: Scalar. Aliases: row.
Returns an Arrow struct using the specified input expressions optionally named. Fields in the returned struct use the optional name or the cN naming convention. For example: c0, c1, c2, etc. For information on comparing and ordering struct values (including NULL handling), see Comparison and Ordering.
  • expression1, expression_n: Expression to include in the output struct. Can be a constant, column, or function, any combination of arithmetic or string operators.

Regular Expression Functions

regexp_count

Kind: Scalar.
Returns the number of matches that a regular expression has in a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • regexp: Regular expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • start: - start: Optional start position (the first position is 1) to search for the regular expression. Can be a constant, column, or function.
  • flags: Optional regular expression flags that control the behavior of the regular expression. The following flags are supported:
    • i: case-insensitive: letters match both upper and lower case
    • m: multi-line mode: ^ and $ match begin/end of line
    • s: allow . to match \n
    • R: enables CRLF mode: when multi-line mode is enabled, \r\n is used
    • U: swap the meaning of x* and x*?

regexp_instr

Kind: Scalar.
Returns the position in a string where the specified occurrence of a POSIX regular expression is located.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • regexp: Regular expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • start: - start: Optional start position (the first position is 1) to search for the regular expression. Can be a constant, column, or function. Defaults to 1
  • N: - N: Optional The N-th occurrence of pattern to find. Defaults to 1 (first match). Can be a constant, column, or function.
  • flags: Optional regular expression flags that control the behavior of the regular expression. The following flags are supported:
    • i: case-insensitive: letters match both upper and lower case
    • m: multi-line mode: ^ and $ match begin/end of line
    • s: allow . to match \n
    • R: enables CRLF mode: when multi-line mode is enabled, \r\n is used
    • U: swap the meaning of x* and x*?
  • subexpr: Optional Specifies which capture group (subexpression) to return the position for. Defaults to 0, which returns the position of the entire match.

regexp_like

Kind: Scalar.
Returns true if a regular expression has at least one match in a string, false otherwise.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • regexp: Regular expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • flags: Optional regular expression flags that control the behavior of the regular expression. The following flags are supported:
    • i: case-insensitive: letters match both upper and lower case
    • m: multi-line mode: ^ and $ match begin/end of line
    • s: allow . to match \n
    • R: enables CRLF mode: when multi-line mode is enabled, \r\n is used
    • U: swap the meaning of x* and x*?

regexp_match

Kind: Scalar.
Returns the first regular expression matches in a string.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • regexp: Regular expression to match against. Can be a constant, column, or function.
  • flags: Optional regular expression flags that control the behavior of the regular expression. The following flags are supported:
    • i: case-insensitive: letters match both upper and lower case
    • m: multi-line mode: ^ and $ match begin/end of line
    • s: allow . to match \n
    • R: enables CRLF mode: when multi-line mode is enabled, \r\n is used
    • U: swap the meaning of x* and x*?

regexp_replace

Kind: Scalar.
Replaces substrings in a string that match a regular expression.
  • str: String expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • regexp: Regular expression to match against. Can be a constant, column, or function.
  • replacement: Replacement string expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • flags: Optional regular expression flags that control the behavior of the regular expression. The following flags are supported:
  • g: (global) Search globally and don’t return after the first match
  • i: case-insensitive: letters match both upper and lower case
  • m: multi-line mode: ^ and $ match begin/end of line
  • s: allow . to match \n
  • R: enables CRLF mode: when multi-line mode is enabled, \r\n is used
  • U: swap the meaning of x* and x*?

Union Functions

union_extract

Kind: Scalar.
Returns the value of the given field in the union when selected, or NULL otherwise.
  • union: Union expression to operate on. Can be a constant, column, or function, and any combination of operators.
  • field_name: String expression to operate on. Must be a constant.

union_tag

Kind: Scalar.
Returns the name of the currently selected field in the union
  • union: Union expression to operate on. Can be a constant, column, or function, and any combination of operators.
Signatures and argument descriptions come from the Unified registry and DataFusion 54.1.0 (Apache-2.0). Registration describes the language registry; backend and connector restrictions still apply.
Last modified on November 4, 2026