anishshri-db commented on code in PR #45780:
URL: https://github.com/apache/spark/pull/45780#discussion_r1546733375
##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithStateInitialStateSuite.scala:
##########
@@ -125,6 +129,43 @@ class InitialStateInMemoryTestClass
}
}
+/**
+ * Class to test stateful processor with initial state and processing timers.
+ * Timers can be registered during initial state handling and can be emitted
after timer
Review Comment:
Nit: `output rows can be emitted`
##########
sql/core/src/test/scala/org/apache/spark/sql/streaming/TransformWithStateInitialStateSuite.scala:
##########
@@ -125,6 +129,43 @@ class InitialStateInMemoryTestClass
}
}
+/**
+ * Class to test stateful processor with initial state and processing timers.
+ * Timers can be registered during initial state handling and can be emitted
after timer
+ * expires even if the grouping key in initial state is not seen in new input
rows.
+ */
+class StatefulProcessorWithInitialStateProcTimerClass
+ extends RunningCountStatefulProcessorWithProcTimeTimerUpdates
+ with StatefulProcessorWithInitialState[String, String, (String, String),
String] {
+ override def handleInitialState(
+ key: String,
+ initialState: String,
+ timerValues: TimerValues): Unit = {
+ // keep a _countState to count the occurrence of grouping key
+ // Will register a timer if key "a" is met for the first time
+ processUnexpiredRows(key, 0L, 1L, timerValues)
+ }
+}
+
+/**
+ * Class to test stateful processor with initial state and event timers.
+ * Timers can be registered during initial state handling and can be emitted
after timer
Review Comment:
same here
--
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]