CARDINALITY
All functions > ARRAY > CARDINALITY
Returns the number of elements in an array.
Syntax
CARDINALITY(array: ARRAY<T>) → BIGINT
sql
Type Parameters:
T
: Any type
Arguments
Parameter | Type | Required | Description |
---|---|---|---|
array | ARRAY<T> | Yes | The input array to count elements from |
Returns
The number of elements in the array as a BIGINT
Notes
- Counts all elements including duplicates and NULL values
- Returns 0 for empty arrays
- Also available as ARRAY_COUNT alias
- Useful for data validation and conditional logic
Aliases
ARRAY_COUNT