cardinality
function
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