You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@flink.apache.org by Yoandy Rodríguez <mr...@gmail.com> on 2019/07/30 15:02:59 UTC
pattern to detect if event field changed
Hello,
I have a stream of events in the form (key, field1, field2) and I would
like to detect every time field2 value changes and emit a new
event on another stream. I searched StackOverflow and [1] was the
closest to my use case but not quite since I don't have a pattern
to match.
Is it possible to express something like this using Flink?
Thanks in advance.
[1].
https://stackoverflow.com/questions/42065388/when-might-flink-support-pattern-match-involving-fields-of-previous-events
Re: pattern to detect if event field changed
Posted by Sameer W <sa...@axiomine.com>.
You could use ValueState (keyed by key) to store the event. And when each
event arrives, check the value in the State to determine if either of
"Field1" or "Field2" has changed. If either of the fields have changed,
update the state with the new event and perform the trigger (emitting the
modified event) operation. If neither has changed don't do anything (leave
State alone)
On Tue, Jul 30, 2019 at 11:03 AM Yoandy Rodríguez <mr...@gmail.com>
wrote:
> Hello,
>
> I have a stream of events in the form (key, field1, field2) and I would
> like to detect every time field2 value changes and emit a new
>
> event on another stream. I searched StackOverflow and [1] was the
> closest to my use case but not quite since I don't have a pattern
>
> to match.
>
>
> Is it possible to express something like this using Flink?
>
>
> Thanks in advance.
>
>
> [1].
>
> https://stackoverflow.com/questions/42065388/when-might-flink-support-pattern-match-involving-fields-of-previous-events
>
>
>