Flink之基本转换算子(mapflatMapfilter)

    科技2024-01-06  97

    map

    顾名思义,就是转换,将流中进去的每一个元素转成另外一种元素。 我们需要实现接口MapFunction

    // T: the type of input elements // O: the type of output elements MapFunction[T, O] map(T): O

    比如:

    val sensorIds: DataStream[String] = readings.map(new MyMapFunction)
    Processed: 0.009, SQL: 8