Flink从入门到实战四[DataStream API]-12-Transform数据转换

Transform的作用就是对数据进行处理、转换,Flink中提供了丰富的API,这类API也称为算子。
数据在经过算子处理后,从一种流转换为另一种流,或者做其他类似分组、分区的处理,按照功能上的不同主要分为:数据流转换、物理分区及算子链接策略等。
整体来看一下算子API的转换关系:

数据流转换
Map DataStream → DataStream
FlatMap DataStream → DataStream
Filter DataStream → DataStream
KeyBy DataStream → KeyedStream
Reduce KeyedStream → DataStream
Window KeyedStream → WindowedStream
WindowAll DataStream → AllWindowedStream
Window Apply WindowedStream → DataStream #
AllWindowedStream → DataStream
WindowReduce WindowedStream → DataStream
Union DataStream* → DataStream
Window Join DataStream,DataStream → DataStream
Interval Join KeyedStream,KeyedStream → DataStream
Window CoGroup DataStream,DataStream → DataStream
Connect DataStream,DataStream → ConnectedStream
CoMap, CoFlatMap ConnectedStream → DataStream
Iterate DataStream → IterativeStream → ConnectedStream

物理分区
Custom Partitioning DataStream → DataStream
Random Partitioning DataStream → DataStream
Rescaling DataStream → DataStream
Broadcasting DataStream → DataStream

算子链和资源组
Start New Chain
Disable Chaining
Set Slot Sharing Group