cboumalh commented on code in PR #52551:
URL: https://github.com/apache/spark/pull/52551#discussion_r2430789703
##########
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:
I'd recommend we remove these two `theta_sketch_agg(columnName: String,
family: String)` and `theta_sketch_agg(e: Column, family: String)` completely.
If we later add another argument that is a of `String` type, we'll have
function overloading ambiguity. Therefore, If a user wants to use a specific
family, they must also pass in the `lgNomEntries` explicitly. It will keep this
file cleaner and avoid magic numbers. This will mean we also need to fix both
builtin.py files to avoid the same phenomenon. I'm open to seeing what others
have to say about this too.
--
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]