pyspark.sql.functions.tuple_sketch_theta_double#

pyspark.sql.functions.tuple_sketch_theta_double(col)[source]#

Returns the theta value from a Datasketches TupleSketch with double summaries.

New in version 4.2.0.

Parameters
colColumn or column name

The column containing a binary TupleSketch representation

Returns
Column

The theta value (between 0.0 and 1.0).

Examples

>>> from pyspark.sql import functions as sf
>>> df = spark.createDataFrame([(1, 10.0), (2, 20.0)], ["key", "value"])
>>> df.agg(sf.tuple_sketch_theta_double(
...     sf.tuple_sketch_agg_double("key", "value"))).show()
+-----------------------------------------------------------------------+
|tuple_sketch_theta_double(tuple_sketch_agg_double(key, value, 12, sum))|
+-----------------------------------------------------------------------+
|                                                                    1.0|
+-----------------------------------------------------------------------+