flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From subash basnet <yasub...@gmail.com>
Subject Datastream reset variable in every-time window in map function
Date Sun, 06 Nov 2016 21:15:41 GMT
Hello there,

I have a requirement to reset variable after every-time window in map
function. Once I set a value to the variable it continues through the next
time window also. I would want the variable to have the same original value
on every next time window.
DataStream<Tuple1<X>> grid = Y.map(new
test()).map(new testMap());

public static final class FindOutlierGrid
extends RichMapFunction<Tuple1<X>, Tuple1<X>> {
int count = 0;

public void open(Configuration parameters) throws Exception {

public FindOutlierGrid() {
this.count = 0;

public Tuple1<X> map(Tuple1<X> gd) throws Exception {

In above map function, I would want count to be zero on every next time
window. But value of count is zero only at start and never get's
initialized to zero again. What could be the way to achieve this on every
next time window?

Best Regards,
Subash Basnet

View raw message