theta_sketch_estimate
Retorna o número estimado de valores únicos, dada a representação binária de um ThetaSketch do Datasketches.
Sintaxe
Python
from pyspark.sql import functions as sf
sf.theta_sketch_estimate(col)
Parâmetros
Parâmetro | Tipo | Descrição |
|---|---|---|
|
| Representação binária do esboço Theta. |
Devoluções
pyspark.sql.Column: O número estimado de valores únicos para o ThetaSketch.
Exemplos
Exemplo 1 : Estimar valores únicos a partir do esboço de Theta
Python
from pyspark.sql import functions as sf
df = spark.createDataFrame([1,2,2,3], "INT")
df.agg(sf.theta_sketch_estimate(sf.theta_sketch_agg("value"))).show()
Output
+--------------------------------------------------+
|theta_sketch_estimate(theta_sketch_agg(value, 12))|
+--------------------------------------------------+
| 3|
+--------------------------------------------------+