Skip to content

Commit ab6036c

Browse files
committed
Fix FlatMapGroupsWithStateSuite
1 parent 1f5d684 commit ab6036c

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

sql/core/src/test/scala/org/apache/spark/sql/streaming/FlatMapGroupsWithStateSuite.scala

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,8 @@ class FlatMapGroupsWithStateSuite extends StateStoreMetricsTest {
125125
var state: GroupStateImpl[Int] = GroupStateImpl.createForStreaming(
126126
None, 1000, 1000, ProcessingTimeTimeout, hasTimedOut = false, watermarkPresent = false)
127127
assert(state.getTimeoutTimestamp === NO_TIMESTAMP)
128+
state.setTimeoutDuration("-1 month 31 days 1 second")
129+
assert(state.getTimeoutTimestamp === 2000)
128130
state.setTimeoutDuration(500)
129131
assert(state.getTimeoutTimestamp === 1500) // can be set without initializing state
130132
testTimeoutTimestampNotAllowed[UnsupportedOperationException](state)
@@ -225,8 +227,9 @@ class FlatMapGroupsWithStateSuite extends StateStoreMetricsTest {
225227
testIllegalTimeout {
226228
state.setTimeoutDuration("-1 month")
227229
}
230+
228231
testIllegalTimeout {
229-
state.setTimeoutDuration("1 month -1 day")
232+
state.setTimeoutDuration("1 month -31 day")
230233
}
231234

232235
state = GroupStateImpl.createForStreaming(
@@ -241,7 +244,7 @@ class FlatMapGroupsWithStateSuite extends StateStoreMetricsTest {
241244
state.setTimeoutTimestamp(10000, "-1 month")
242245
}
243246
testIllegalTimeout {
244-
state.setTimeoutTimestamp(10000, "1 month -1 day")
247+
state.setTimeoutTimestamp(10000, "1 month -32 day")
245248
}
246249
testIllegalTimeout {
247250
state.setTimeoutTimestamp(new Date(-10000))
@@ -253,7 +256,7 @@ class FlatMapGroupsWithStateSuite extends StateStoreMetricsTest {
253256
state.setTimeoutTimestamp(new Date(-10000), "-1 month")
254257
}
255258
testIllegalTimeout {
256-
state.setTimeoutTimestamp(new Date(-10000), "1 month -1 day")
259+
state.setTimeoutTimestamp(new Date(-10000), "1 month -32 day")
257260
}
258261
}
259262

0 commit comments

Comments
 (0)