I agree it looks like a bug. Filed https://issues.apache.org/jira/browse/BEAM-6934
On Thu, Mar 28, 2019 at 5:18 PM Reuven Lax <re...@google.com> wrote: > This looks like a bug to me. > > On Thu, Mar 28, 2019 at 2:52 PM Amar Pai <a...@lyft.com> wrote: > >> Hi, >> >> I'm running into some unexpected behavior when trying to unit test a >> stateful DoFn that uses watermark timers as well as bag state. I'm >> following the example here: >> https://github.com/apache/beam/blob/master/sdks/python/apache_beam/transforms/userstate_test.py#L333 >> >> Expected behavior: >> When using TestStream, if a stateful DoFn adds value 'foo' to BagState >> then sets two watermark timers t1 and t2, where t1 clears the bag state and >> t2 reads from bag state and emits the contents, if t1.time < t2.time then >> nothing should get emitted when the TestPipeline is run. (bag state should >> be cleared by timer at t1 before it is read from by timer at t2) >> >> Actual behavior: >> For the scenario described above, results get emitted despite t1.time >> being less than t2.time. >> I've created a gist with a demonstration of the problem: >> https://gist.github.com/jcruelty/3bf5ce5865110372a2d1650b1421cde1 >> >> >> Is this a bug? Would appreciate your thoughts. >> cheers >> >> Amar >> >