rangadi commented on code in PR #41558:
URL: https://github.com/apache/spark/pull/41558#discussion_r1227271011
##########
connector/connect/common/src/main/protobuf/spark/connect/relations.proto:
##########
@@ -905,6 +906,29 @@ message ApplyInPandasWithState {
string timeout_conf = 7;
}
+message FlatMapGroupsWithState {
Review Comment:
Add documentation
##########
connector/connect/client/jvm/src/test/scala/org/apache/spark/sql/KeyValueGroupedDatasetE2ETestSuite.scala:
##########
@@ -447,4 +449,20 @@ class KeyValueGroupedDatasetE2ETestSuite extends QueryTest
with SQLHelper {
checkDataset(keys, "1", "2", "10", "20")
}
+
+ test("flatMapGroupsWithState") {
+ val stateFunc = (key: String, values: Iterator[String], state:
GroupState[Int]) => {
+ if (state.exists) throw new IllegalArgumentException("state.exists
should be false")
+ Iterator((key, values.size))
+ }
+
+ val session: SparkSession = spark
+ import session.implicits._
+ val values = Seq("a", "a", "b", "c", "c", "c", "c").toDS()
+ .groupByKey(x => x)
+ .flatMapGroupsWithState(Append, GroupStateTimeout.NoTimeout)(stateFunc)
Review Comment:
Could you add a test for mapGroupsWithState() as well? It could be similarly
simple.
--
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]