vicennial commented on code in PR #49111:
URL: https://github.com/apache/spark/pull/49111#discussion_r1876526425


##########
connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/KeyValueGroupedDataset.scala:
##########
@@ -460,14 +460,22 @@ private class KeyValueGroupedDatasetImpl[K, V, IK, IV](
   }
 
   override protected def aggUntyped(columns: TypedColumn[_, _]*): Dataset[_] = 
{
-    // TODO(SPARK-43415): For each column, apply the valueMap func first...
+    val aggCols: Seq[Column] = valueMapFunc match {
+      case Some(func) =>
+        val udf = SparkUserDefinedFunction(func, ivEncoder :: Nil, 
vEncoder).apply(col("*"))
+        // The mapValues fn is defined as: mapValuesUdf, [aggExprs]+,
+        // Upon receiving this fn, split it into mapValuesUdf and [aggExprs]+.
+        Seq(Column.fn("map_values", udf +: columns: _*))

Review Comment:
   Any requirement for the name to be unique here? What if there's already a 
udf registered as `map_values` by the user?



-- 
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: reviews-unsubscr...@spark.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to