Oharra
Baimena behar duzu orria atzitzeko. Direktorioetan saioa has dezakezu edo haiek alda ditzakezu.
Baimena behar duzu orria atzitzeko. Direktorioak alda ditzakezu.
Combina dos representaciones binarias de objetos Datasketches Theta Sketch mediante un objeto Datasketches Union.
Syntax
from pyspark.sql import functions as sf
sf.theta_union(col1, col2, lgNomEntries=None)
Parámetros
| Parámetro | Tipo | Description |
|---|---|---|
col1 |
pyspark.sql.Column o str |
El primer croquis de Theta. |
col2 |
pyspark.sql.Column o str |
El segundo croquis de Theta. |
lgNomEntries |
pyspark.sql.Column o int, opcional |
El log-base-2 de entradas nominales para la operación de unión (debe estar entre 4 y 26, el valor predeterminado es 12). |
Devoluciones
pyspark.sql.Column: representación binaria del boceto Theta combinado.
Examples
Ejemplo 1: Unión de dos bocetos de Theta
from pyspark.sql import functions as sf
df = spark.createDataFrame([(1,4),(2,5),(2,5),(3,6)], "struct<v1:int,v2:int>")
df = df.agg(
sf.theta_sketch_agg("v1").alias("sketch1"),
sf.theta_sketch_agg("v2").alias("sketch2")
)
df.select(sf.theta_sketch_estimate(sf.theta_union(df.sketch1, "sketch2"))).show()
+--------------------------------------------------------+
|theta_sketch_estimate(theta_union(sketch1, sketch2, 12))|
+--------------------------------------------------------+
| 6|
+--------------------------------------------------------+