Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Applies to: Databricks SQL
Databricks Runtime
Returns the size of expr
.
Syntax
cardinality(expr)
Arguments
expr
: An ARRAY or MAP expression.
Returns
An INTEGER.
Examples
> SELECT cardinality(array('b', 'd', 'c', 'a'));
4
> SELECT cardinality(map('a', 1, 'b', 2));
2