bit_count
function
Applies to: Databricks SQL Databricks Runtime
Returns the number of bits set in the argument.
To count bits in a BINARY
expression use bitmap_count function.
Syntax
bit_count(expr)
Arguments
expr
: ABIGINT
orBOOLEAN
expression.
Returns
An INTEGER
.
Examples
> SELECT bit_count(0);
0
> SELECT bit_count(5);
2
> SELECT bit_count(-1);
64
> SELECT bit_count(true);
1