I've added your snippet as a unit test, and fixed that test[1] : ) - thanks
for reporting the issue. Please let me know if you see any other issues
like this.
Best
-P.

[1] https://github.com/apache/beam/pull/8252

On Thu, Apr 4, 2019 at 2:46 PM Pablo Estrada <[email protected]> wrote:

> I saw similar issues. I'll try to debug this tomorrow. It'll take some
> time to study the code, so we'll see. Assigning the issue to me.
>
> On Fri, Mar 29, 2019 at 6:43 AM Steve Niemitz <[email protected]> wrote:
>
>> This reminds me of a bug I had filed for the direct runner a few weeks
>> ago, except I was running into it in Java and not python.
>> https://issues.apache.org/jira/browse/BEAM-6813
>>
>> On Thu, Mar 28, 2019 at 9:04 PM Ahmet Altay <[email protected]> wrote:
>>
>>> 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 <[email protected]> wrote:
>>>
>>>> This looks like a bug to me.
>>>>
>>>> On Thu, Mar 28, 2019 at 2:52 PM Amar Pai <[email protected]> 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
>>>>>
>>>>

Reply via email to