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

Reply via email to