use of org.apache.flink.api.common.functions.ReduceFunction in project flink by apache.
the class TimestampITCase method testErrorOnEventTimeWithoutTimestamps.
@Test
public void testErrorOnEventTimeWithoutTimestamps() {
StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
env.setParallelism(2);
DataStream<Tuple2<String, Integer>> source1 = env.fromElements(new Tuple2<>("a", 1), new Tuple2<>("b", 2));
source1.keyBy(0).window(TumblingEventTimeWindows.of(Time.seconds(5))).reduce(new ReduceFunction<Tuple2<String, Integer>>() {
@Override
public Tuple2<String, Integer> reduce(Tuple2<String, Integer> value1, Tuple2<String, Integer> value2) {
return value1;
}
}).print();
try {
env.execute();
fail("this should fail with an exception");
} catch (Exception e) {
// expected
}
}
Aggregations