Spark2.0: Structured Streaming
来源:互联网 发布:易语言安装包源码 编辑:程序博客网 时间:2024/05/21 20:24
启动nc:
nc -lk 9999
启动spark-shell:
val lines = spark.readStream. | format("socket"). | option("host","localhost"). | option("port",9999). | load();lines: org.apache.spark.sql.DataFrame = [value: string]val words = lines.as[String].flatMap(_.split(" "))val wordCounts = words.groupBy("value").count()val query = wordCounts.writeStream. | outputMode("complete"). | format("console"). | start();query: org.apache.spark.sql.streaming.StreamingQuery = org.apache.spark.sql.execution.streaming.Streamin gQueryWrapper@22cf6c9cquery.awaitTermination()-------------------------------------------Batch: 0-------------------------------------------+-----+-----+|value|count|+-----+-----+|hello| 1|| word| 1|+-----+-----+-------------------------------------------Batch: 1-------------------------------------------+-----+-----+|value|count|+-----+-----+|hello| 2|| word| 1||world| 1|+-----+-----+-------------------------------------------Batch: 2-------------------------------------------+-----+-----+|value|count|+-----+-----+|hello| 2|| bye| 1|| word| 1||world| 2|| ny| 1|+-----+-----+-------------------------------------------Batch: 3-------------------------------------------+------+-----+| value|count|+------+-----+| hello| 2|| bye| 1|| word| 1||sounds| 1|| world| 2|| good| 1|| ny| 1|+------+-----+-------------------------------------------Batch: 4-------------------------------------------+------+-----+| value|count|+------+-----+| hello| 2|| bye| 3|| word| 1||sounds| 1|| world| 2|| good| 1|| ny| 1|+------+-----+
阅读全文
0 0
- Spark2.0 Structured Streaming
- Spark2.0 Structured Streaming
- Spark2.0: Structured Streaming
- Spark2.0 Structured Streaming
- spark2.2 structured Streaming
- Structured Streaming
- spark 2.0.0 Structured Streaming Programming
- 「Spark-2.2.0」Structured Streaming
- Spark 2.1 structured streaming
- Structured Streaming 输入输出
- Spark Streaming 编程指南-Spark2.0(官方文档)
- Spark Structured Streaming、Kafak整合
- structured streaming ——wordcounts_kafka
- kafka+Structured Streaming+s3+dynamodb
- Structured Streaming Programming[结构化流式编程]
- Spark Structured Streaming入门编程指南
- spark structured streaming GroupState setTimeoutDuration触发机制
- Structured Streaming 实现思路与实现概述
- NBU Rman异机恢复Oracle
- RecyclerView 实现轮播图
- 这两天看到了一下大神SQL数据库的优化随手记录了一波
- 随机抽样一致 RANSAC(转)
- Mybatis之批量操作-Oracle
- Spark2.0: Structured Streaming
- LuoguP2397 yyy loves Maths VI
- Java集合---Arrays类源码解析
- 自然语言 基础(一)
- nginx proxy_set_header设置、自定义header
- 获取当前访问url的来源地址
- 欢迎使用CSDN-markdown编辑器
- Android定位程序——WIFI定位,GPS定位
- 使用jmeter步骤小结