WweiL commented on code in PR #41558:
URL: https://github.com/apache/spark/pull/41558#discussion_r1227294305
##########
connector/connect/common/src/main/scala/org/apache/spark/sql/connect/common/UdfUtils.scala:
##########
@@ -95,6 +96,26 @@ private[sql] object UdfUtils extends Serializable {
}
}
+ def mapValuesAdaptor[K, V, S, U, IV](
+ f: (K, Iterator[V], GroupState[S]) => U,
+ valueMapFunc: IV => V): (K, Iterator[IV], GroupState[S]) => U = {
+ (k: K, itr: Iterator[IV], s: GroupState[S]) =>
+ {
+ f(k, itr.map(v => valueMapFunc(v)), s)
+ }
+ }
+
+ def mapGroupsWithStateFuncToScalaFunc[K, V, S, U](
+ f: MapGroupsWithStateFunction[K, V, S, U]): (K, Iterator[V],
GroupState[S]) => U = {
+ (key, data, groupState) => f.call(key, data.asJava, groupState)
+ }
+
+ def flatMapGroupsWithStateFuncToScalaFunc[K, V, S, U](
Review Comment:
With this function, I think we also need to add `java-specific` APIs to
`KeyValueGroupedDataset`?
For example:
https://github.com/apache/spark/blob/28869401eff8fcd94aa68d662fdd4d3dbe2f58af/connector/connect/client/jvm/src/main/scala/org/apache/spark/sql/KeyValueGroupedDataset.scala#L118-L136
and this:
https://github.com/apache/spark/blob/28869401eff8fcd94aa68d662fdd4d3dbe2f58af/sql/core/src/main/scala/org/apache/spark/sql/KeyValueGroupedDataset.scala#L575-L603
--
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]