1. aggregations
aggregations通过keyedStream进行一些聚合操作,例如sum(),min(),max()等。示例如下:
KeyedStream.sum(0)或者KeyedStream.sum(“Key”)
2. connect
connect和union类似,但是只能连接两个流,两个流的数据类型可以不同,会对两个流中的数据应用不同的处理方法。示例如下:
DataStreamSource<Long> src1 = env.addSource(new MyParalleSource())
DataStreamSource<Long> src2 = env.addSource(new MyParalleSource())
SingleOutputStreamOperator<String> src2_str = text2.map(() ->(return "str" + value));
ConnectedStreams<Long, String> connectStream = text1.connect(text2_str);
3. split
根据一定的规则将一个数据流切分成多个数据流。
4. Window/WindowAll
window按时间进行聚合或者其他条件对KeyedStream进行分组
inputStream.keyBy(0).window(Time.seconds(10))
windowAll 函数允许对常规数据流进行分组。通常,这是非并行数据转换,因为它在非分区数据流上运行。
inputStream.keyBy(0).windowAll(Time.seconds(10))