cboumalh commented on code in PR #52551:
URL: https://github.com/apache/spark/pull/52551#discussion_r2422059263


##########
sql/api/src/main/scala/org/apache/spark/sql/functions.scala:
##########
@@ -1242,6 +1253,47 @@ object functions {
   def theta_sketch_agg(columnName: String): Column =
     theta_sketch_agg(Column(columnName))
 
+  /**
+   * Aggregate function: returns the compact binary representation of the 
Datasketches ThetaSketch
+   * built with the values in the input column, configured with `lgNomEntries` 
and `family`.
+   *
+   * @group agg_funcs
+   * @since 4.1.0
+   */
+  def theta_sketch_agg(e: Column, lgNomEntries: Int, family: String): Column =
+    Column.fn("theta_sketch_agg", e, lit(lgNomEntries), lit(family))
+
+  /**
+   * Aggregate function: returns the compact binary representation of the 
Datasketches ThetaSketch
+   * built with the values in the input column, configured with `lgNomEntries` 
and `family`.
+   *
+   * @group agg_funcs
+   * @since 4.1.0
+   */
+  def theta_sketch_agg(columnName: String, lgNomEntries: Int, family: String): 
Column =
+    theta_sketch_agg(Column(columnName), lgNomEntries, family)
+
+  /**
+   * Aggregate function: returns the compact binary representation of the 
Datasketches ThetaSketch
+   * built with the values in the input column, configured with the specified 
`family` and default
+   * lgNomEntries.
+   *
+   * @group agg_funcs
+   * @since 4.1.0
+   */
+  def theta_sketch_agg(e: Column, family: String): Column =
+    theta_sketch_agg(e, 12, family)

Review Comment:
   The hardcoded 12 matches the Catalyst default, so behaviorally it’s fine. 
Still, duplicating an internal default in the public layer is a bit awkward .We 
could consider making this explicit (functions above preferred) or defining a 
local constant for clarity.



-- 
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]

Reply via email to