Note
Ang pag-access sa pahinang ito ay nangangailangan ng pahintulot. Maaari mong subukang mag-sign in o magpalit ng mga direktoryo.
Ang pag-access sa pahinang ito ay nangangailangan ng pahintulot. Maaari mong subukang baguhin ang mga direktoryo.
Returns the number of set bits in the input bitmap.
Syntax
from pyspark.sql import functions as sf
sf.bitmap_count(col)
Parameters
| Parameter | Type | Description |
|---|---|---|
col |
pyspark.sql.Column or str |
The input bitmap. |
Examples
Example 1: Count set bits in a bitmap
from pyspark.sql import functions as sf
df = spark.createDataFrame([("FFFF",)], ["a"])
df.select(sf.bitmap_count(sf.to_binary(df.a, sf.lit("hex")))).show()
+-------------------------------+
|bitmap_count(to_binary(a, hex))|
+-------------------------------+
| 16|
+-------------------------------+