Re: window function not working when control stream broadcast
Posted by
Sam Huang on
URL: http://deprecated-apache-flink-user-mailing-list-archive.369.s1.nabble.com/window-function-not-working-when-control-stream-broadcast-tp12093p12121.html
Hi Timo,
The window function sinks the data into InfluxDB, and it's not triggered.
If I comment the ".timeWindow", and print results after the reduce function, it works
Code for window function is here:
private static class WindowFunImpl implements WindowFunction<KVTuple6,Point,Tuple,TimeWindow> {
@Override
public void apply(Tuple tuple, TimeWindow window, Iterable<KVTuple6> iterable,
Collector<Point> collector) throws Exception {
KVTuple6 kvTypeTuple = iterable.iterator().next();
System.out.println("window: " + kvTypeTuple); // Doesn't work here if use broadcast
Point.Builder builder = Point.measurement(INFLUXDB_MEASUREMENT)
.time(window.getStart(), TimeUnit.MILLISECONDS)
.tag(TAG_DOMAIN, kvTypeTuple.f0)
.tag(TAG_DEVICE, kvTypeTuple.f1)
.tag(TAG_TYPE, kvTypeTuple.f2)
.tag(TAG_KEY, kvTypeTuple.f3)
.addField(FIELD, kvTypeTuple.f4);
collector.collect(builder.build());
}
}