Github user amitsela commented on a diff in the pull request: https://github.com/apache/spark/pull/17179#discussion_r105230719 --- Diff: sql/core/src/test/scala/org/apache/spark/sql/streaming/MapGroupsWithStateSuite.scala --- @@ -83,6 +88,34 @@ class MapGroupsWithStateSuite extends StateStoreMetricsTest with BeforeAndAfterA } } + test("KeyedState - isTimingOut, setTimeoutDuration") { + import KeyedStateImpl._ + var state: KeyedStateImpl[String] = null + state = new KeyedStateImpl[String](None) + + assert(state.isTimingOut === false) + assert(state.getTimeoutTimestamp === TIMEOUT_TIMESTAMP_NOT_SET) + intercept[UnsupportedOperationException] { + state.setTimeoutDuration(1000) + } + intercept[UnsupportedOperationException] { + state.setTimeoutDuration("1 day") + } + assert(state.getTimeoutTimestamp === TIMEOUT_TIMESTAMP_NOT_SET) + + state = new KeyedStateImpl[String](None, 1000, isTimeoutEnabled = true, isTimingOut = false) --- End diff -- Judging by the tests below, it seems that timeout timestamps are `timeout + batchInterval`, which makes total sense but it might be worth adding to documentation that time-based triggers are affected by "system-latency" or something.. I believe this is true for most streaming frameworks anyway, but this "disclaimer" might avoid user confusion as he might expect his output after 200msec while internal batch interval is 250msec. I'm only noting this because It caught me off-guard, until i saw the 1000msec batchInterval passed to `KeyedStateImpl` constructor.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org