flink的DataSet算子讲解
本文是已 官方文档 为基础进行个人解释,有错误地方还望多多包涵: https://ci.apache.org/projects/flink/flink-docs-release-1.3/api/scala/index.html#org.apache.flink.api.scala.DataSet 首先启动flink集群模式,再启动./start-scala-shell.sh remote master 8082 启动后,flink会提示你:使用预绑定执行环境来实现批处理或流媒体程序。即: 第一种: Batch - Use the 'benv' variable(批量使用“benv”变量) val dataSet = benv.readTextFile("/path/to/data") dataSet.writeAsText("/path/to/output") benv.execute("My batch program") HINT: You can use print() on a DataSet to print the contents to the shell.(提示:您可以在数据集上使用print()来 将内容打印到shell中。) 第二种: Streaming - Use the 'senv' variable (流式-使用“senv”变量) val