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
Related functions
Feedback
https://aka.ms/ContentUserFeedback.
Coming soon: Throughout 2024 we will be phasing out GitHub Issues as the feedback mechanism for content and replacing it with a new feedback system. For more information see:Submit and view feedback for