ReferenceSPQL

Lists

Measure, search, and reduce list values.

Scalar Functions

FunctionSummary
spql.list.containsReturn whether a list contains a value.
spql.list.getReturn a list element at a zero-based index.
spql.list.is_emptyReturn whether a list contains no elements.
spql.list.lenReturn the number of elements in a list.
spql.list.sumSum the non-null elements of a numeric list.

spql.list.contains

Return whether a list contains a value.

  • Kind: scalar function
  • Volatility: immutable
spql.list.contains(list, value) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

The value must be a constant; a value that varies per row is not yet supported and is rejected when the query is planned. A null list or a null value yields null, and an empty list yields false. Null entries inside a list never match: the result is true exactly when a non-null entry equals the value.

Parameters

NameRequiredTypeDescription
listyeslist<T>List to search.
valueyesTValue to look for.

Returns

A boolean value or expression.

spql.list.get

Return a list element at a zero-based index.

  • Kind: scalar function
  • Volatility: immutable
spql.list.get(list, index) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

A null list, null index, negative index, or index outside the list returns null. Null elements remain null.

Parameters

NameRequiredTypeDescription
listyeslist<T>List value or expression.
indexyesi64?Zero-based element index, which may vary per row.

Returns

The nullable list element type.

spql.list.is_empty

Return whether a list contains no elements.

  • Kind: scalar function
  • Volatility: immutable
spql.list.is_empty(list) -> bool?

Nullable when an argument is nullable; otherwise non-nullable.

Parameters

NameRequiredTypeDescription
listyeslist<T>List value or expression.

Returns

A boolean value or expression.

spql.list.len

Return the number of elements in a list.

  • Kind: scalar function
  • Volatility: immutable
spql.list.len(list) -> u64?

Nullable when an argument is nullable; otherwise non-nullable.

Parameters

NameRequiredTypeDescription
listyeslist<T>List value or expression.

Returns

An unsigned 64-bit length.

spql.list.sum

Sum the non-null elements of a numeric list.

  • Kind: scalar function
  • Volatility: immutable
spql.list.sum(list) -> inferred

The result type and nullability are inferred from the argument types when the call is bound.

A null, empty, or all-null list returns null. Integer results widen to the engine's aggregate accumulator type.

Parameters

NameRequiredTypeDescription
listyeslist<numeric>Numeric list to reduce.

Returns

A nullable numeric value.

Found a problem? Edit this page or report an issue.

On this page