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

ParameterTypeRequiredDescription
arrayARRAY<T>YesThe 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

Examples

Last update at: 2025/10/13 10:23:46