set a retract switch

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

set a retract switch

lec ssmi
Hi:
     During the execution of flink, especially the sql API, many operations
in DataStream are not available. In many cases, we don't care about the
DELETE record when retracting. Is it possible to set a switch so that the
DELETE record when retracting is not processed? In other words, the
downstream only receives a value after UPDATE, and does not need to receive
the value before UPDATE. In some programming modes, processing DELETE
records actually makes the logic more complicated.

Best
Lec Ssmi
Reply | Threaded
Open this post in threaded view
|

Re: set a retract switch

Jark Wu-2
Hi Lec,

You can use `StreamTableEnvironment#toRetractStream(table, Row.class)` to
get a `DataStream<Tuple2<Boolean, Row>>`.
The true Boolean flag indicates an add message, a false flag indicates a
retract (delete) message. So you can just simply apply
 a flatmap function after this to ignore the false messages. Then you can
get a pure UPSERT stream.

Btw, such question should be posted in [hidden email], not the dev
mailing list.

Best,
Jark

On Thu, 7 May 2020 at 10:07, lec ssmi <[hidden email]> wrote:

> Hi:
>      During the execution of flink, especially the sql API, many operations
> in DataStream are not available. In many cases, we don't care about the
> DELETE record when retracting. Is it possible to set a switch so that the
> DELETE record when retracting is not processed? In other words, the
> downstream only receives a value after UPDATE, and does not need to receive
> the value before UPDATE. In some programming modes, processing DELETE
> records actually makes the logic more complicated.
>
> Best
> Lec Ssmi
>