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.
Returns the number of bits that are set in the argument expr as an unsigned 64-bit integer, or NULL if the argument is NULL.
For the corresponding Databricks SQL function, see bit_count function.
Syntax
from pyspark.databricks.sql import functions as dbf
dbf.bit_count(col=<col>)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
target column to compute on. |
Returns
pyspark.sql.Column or NULL if the argument is NULL.: the number of bits that are set in the argument expr as an unsigned 64-bit integer,
Examples
from pyspark.databricks.sql import functions as dbf
spark.sql("SELECT * FROM VALUES (0), (1), (2), (3), (NULL) AS TAB(value)").select("*", dbf.bit_count("value")).show()