pyspark.sql.functions.tuple_sketch_agg_integer#
- pyspark.sql.functions.tuple_sketch_agg_integer(key, summary, lgNomEntries=None, mode=None)[source]#
Aggregate function: returns the compact binary representation of the Datasketches TupleSketch with integer summaries built from the key and summary columns.
Added in version 4.2.0.
- Parameters:
- key
Columnor column name The column containing key values. A column that evaluates to an array, binary, double, float, integer, long, or string.
- summary
Columnor column name The column containing integer summary values. A column that evaluates to an integer.
- lgNomEntries
Columnor int, optional The log-base-2 of nominal entries (must be between 4 and 26, defaults to 12) A column that evaluates to an integer.
- mode
Columnor str, optional The summary mode: “sum” (default), “min”, “max”, or “alwaysone”
- key
- Returns:
ColumnThe binary representation of the TupleSketch.
See also
Examples
>>> from pyspark.sql import functions as sf >>> df = spark.createDataFrame([(1, 10), (2, 20), (2, 30)], ["key", "value"]) >>> df.agg(sf.tuple_sketch_estimate_integer( ... sf.tuple_sketch_agg_integer("key", "value"))).show() +----------------------------------------------------------------------------+ |tuple_sketch_estimate_integer(tuple_sketch_agg_integer(key, value, 12, sum))| +----------------------------------------------------------------------------+ | 2.0| +----------------------------------------------------------------------------+