Data transformations transform the data stream from one form into another. The input could be one or more data streams and the output could also be zero, or one or more data streams. Now let's try to understand each transformation one by one.


This is one of the simplest transformations, where the input is one data stream and the output is also one data stream.

In Java: MapFunction<Integer, Integer>() { 
  public Integer map(Integer value) throws Exception { 
        return 5 * value; 

In Scala: { x => x * 5 } 


FlatMap takes one record and outputs zero, one, or more than one record.

In Java:

inputStream.flatMap(new FlatMapFunction<String, String>() { @Override public void flatMap(String ...

Get Learning Apache Flink now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.