flink自定义Map方法

  class MyRichMapper extends RichMapFunction[SensorReding,String]{

    override def open(parameters: Configuration): Unit = {
      //做一些初始化操作,比如数据库的连接
//      getRuntimeContext
    }
    override def map(in: SensorReding): String = in.id+"temperature"

    override def close(): Unit = {
      //一般做收尾工作,比如关闭连接,或者清空状态

    }
  }

}
author@nohert
原文地址:https://www.cnblogs.com/gzgBlog/p/14928219.html