anishshri-db commented on code in PR #48205:
URL: https://github.com/apache/spark/pull/48205#discussion_r1774356399
##########
sql/core/src/test/scala/org/apache/spark/sql/execution/datasources/v2/state/StateDataSourceTransformWithStateSuite.scala:
##########
@@ -563,4 +574,94 @@ class StateDataSourceTransformWithStateSuite extends
StateStoreMetricsTest
}
}
}
+
+ test("state data source - processing-time timers integration") {
+ withSQLConf(SQLConf.STATE_STORE_PROVIDER_CLASS.key ->
+ classOf[RocksDBStateStoreProvider].getName,
+ SQLConf.SHUFFLE_PARTITIONS.key ->
+ TransformWithStateSuiteUtils.NUM_SHUFFLE_PARTITIONS.toString) {
+ withTempDir { tempDir =>
+ val clock = new StreamManualClock
+
+ val inputData = MemoryStream[String]
+ val result = inputData.toDS()
+ .groupByKey(x => x)
+ .transformWithState(
+ new RunningCountStatefulProcessorWithProcTimeTimerUpdates(),
+ TimeMode.ProcessingTime(),
+ OutputMode.Update())
+
+ testStream(result, OutputMode.Update())(
+ StartStream(Trigger.ProcessingTime("1 second"), triggerClock = clock,
+ checkpointLocation = tempDir.getCanonicalPath),
+ AddData(inputData, "a"),
+ AdvanceManualClock(1 * 1000),
+ CheckNewAnswer(("a", "1")), // at batch 0, ts = 1, timer = "a" ->
[6] (= 1 + 5)
+ AddData(inputData, "a"),
+ AdvanceManualClock(2 * 1000),
+ CheckNewAnswer(("a", "2")), // at batch 1, ts = 3, timer = "a" ->
[9.5] (2 + 7.5)
Review Comment:
Thanks for the update
--
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]