flink-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stephan Epping <stephan.epp...@zweitag.de>
Subject apply with fold- and window function
Date Mon, 14 Nov 2016 13:49:14 GMT

I wondered if there is a particular reason for the window function to have explicitly the
same input/output type?
public <R> SingleOutputStreamOperator<R> apply(R initialValue, FoldFunction<T,
R> foldFunction, WindowFunction<R, R, K, W> function)
for example (the following does not work):
    DataStream<SensorAggregatedValue> aggregates = values
            .assignTimestampsAndWatermarks(new SensorTimestampsAndWatermarks())
            .apply(new SensorValueAccumulator(), new AccumulateSensorValues(), new AggregateSensorValues());
because in this case my accumulator object does not have any id or timestamp information -
just count, sum, min, max etc. And finally in the window function I receive the key (sensorId)
and time window (start/end) and can build an aggregated value with all information needed.
But currently the apply function forces me to use one cluttered class with id, count, sum,
…, where the id,start,end time are invalid during the fold function.

kind regards,
View raw message