RyanBerti commented on code in PR #40615:
URL: https://github.com/apache/spark/pull/40615#discussion_r1181936673
##########
python/pyspark/sql/functions.py:
##########
@@ -10113,6 +10113,157 @@ def unwrap_udt(col: "ColumnOrName") -> Column:
return _invoke_function("unwrap_udt", _to_java_column(col))
+@try_remote_functions
+def hll_sketch_agg(col: "ColumnOrName", lgConfigK: Optional[int] = None) ->
Column:
+ """
+ Aggregate function: returns the updatable binary representation of the
Datasketches
+ HllSketch configured with lgConfigK arg.
+
+ .. versionadded:: 3.5.0
+
+ Parameters
+ ----------
+ col : :class:`~pyspark.sql.Column` or str
+ lgConfigK : int, optional
+ The log-base-2 of K, where K is the number of buckets or slots for the
HllSketch
+
+ Returns
+ -------
+ :class:`~pyspark.sql.Column`
+ The binary representation of the HllSketch.
+
+ Examples
+ --------
+ >>> df = spark.createDataFrame([1,2,2,3], "INT")
+ >>> df =
df.agg(hll_sketch_estimate(hll_sketch_agg("value")).alias("distinct_cnt"))
+ >>> df.show()
+ +------------+
+ |distinct_cnt|
+ +------------+
+ | 3|
+ +------------+
+ """
+ if lgConfigK is not None:
+ return _invoke_function("hll_sketch_agg", _to_java_column(col),
lgConfigK)
+ else:
+ return _invoke_function("hll_sketch_agg", _to_java_column(col))
+
+
+@try_remote_functions
+def hll_union_agg(col: "ColumnOrName", allowDifferentLgConfigK: Optional[bool]
= None) -> Column:
+ """
+ Aggregate function: returns the updaable binary representation of the
Datasketches
Review Comment:
Done!
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]