इसके माध्यम से साझा किया गया


cardinality function

Applies to: check marked yes Databricks SQL check marked yes 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