Lists
Measure, search, and reduce list values.
Scalar Functions
| Function | Summary |
|---|---|
spql.list.contains | Return whether a list contains a value. |
spql.list.get | Return a list element at a zero-based index. |
spql.list.is_empty | Return whether a list contains no elements. |
spql.list.len | Return the number of elements in a list. |
spql.list.sum | Sum 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) -> inferredThe 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
| Name | Required | Type | Description |
|---|---|---|---|
list | yes | list<T> | List to search. |
value | yes | T | Value 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) -> inferredThe 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
| Name | Required | Type | Description |
|---|---|---|---|
list | yes | list<T> | List value or expression. |
index | yes | i64? | 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
| Name | Required | Type | Description |
|---|---|---|---|
list | yes | list<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
| Name | Required | Type | Description |
|---|---|---|---|
list | yes | list<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) -> inferredThe 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
| Name | Required | Type | Description |
|---|---|---|---|
list | yes | list<numeric> | Numeric list to reduce. |
Returns
A nullable numeric value.