kll_sketch_get_n_bigint
Returns the number of items collected in the KLL bigint sketch.
Syntax
Python
from pyspark.sql import functions as sf
sf.kll_sketch_get_n_bigint(col)
Parameters
Parameter | Type | Description |
|---|---|---|
|
| The KLL bigint sketch binary representation. |
Returns
pyspark.sql.Column: The count of items in the sketch.
Examples
Example 1: Get count of items in KLL bigint sketch
Python
from pyspark.sql import functions as sf
df = spark.createDataFrame([1,2,3,4,5], "INT")
sketch_df = df.agg(sf.kll_sketch_agg_bigint("value").alias("sketch"))
sketch_df.select(sf.kll_sketch_get_n_bigint("sketch")).show()
Output
+-------------------------------+
|kll_sketch_get_n_bigint(sketch)|
+-------------------------------+
| 5|
+-------------------------------+