spark rdd collect操作官方解释
来源:互联网 发布:网络教育学位考试难吗 编辑:程序博客网 时间:2024/04/29 13:19
官方原文如下:
Printing elements of an RDD
Another common idiom is attempting to print out the elements of an RDD using rdd.foreach(println)
or rdd.map(println)
. On a single machine, this will generate the expected output and print all the RDD’s elements. However, in cluster
mode, the output to stdout
being called by the executors is now writing to the executor’s stdout
instead, not the one on the driver, so stdout
on the driver won’t show these! To print all elements on the driver, one can use the collect()
method to first bring the RDD to the driver node thus: rdd.collect().foreach(println)
. This can cause the driver to run out of memory, though, because collect()
fetches the entire RDD to a single machine; if you only need to print a few elements of the RDD, a safer approach is to use the take()
: rdd.take(100).foreach(println)
.
主要意思是:
打印一个弹性分布式数据集元素,使用时要注意不要导致内存溢出!
建议使用 take()
: rdd.take(100).foreach(println),
而不使用rdd.collect().foreach(println)。
因为后者会导致内存溢出!!
- spark rdd collect操作官方解释
- Spark API 详解/大白话解释 之 RDD、partition、count、collect
- 3.4 Spark RDD Action操作1-first、count、lookup、collect
- spark RDD解释
- Spark算子:RDD行动Action操作(1)–first、count、reduce、collect
- Spark算子:RDD行动Action操作(1)–first、count、reduce、collect
- [Spark]Spark RDD 指南四 RDD操作
- Spark RDD操作
- spark RDD keyvalue操作
- Spark RDD transformation操作
- spark RDD transformation操作
- spark RDD 基本操作
- spark rdd 操作
- Spark RDD创建操作
- Spark中RDD操作
- Spark RDD基本操作
- spark-RDD集合操作
- Spark RDD基本操作
- popwindow简单使用(一)
- bash
- js控制只允许输入数字
- 网狐6603 麻将、房卡类子游戏《四川麻将》(手机端+服务器+网站后台)全套完整源码
- ascii码与键盘代码的区别
- spark rdd collect操作官方解释
- centos每天自动备份mysql数据库
- Java虚拟机学习 - 类加载过程
- inotify + msmtp + mutt 监控文件变化并发送邮件的配置实例-msmtp的QQ邮箱配置
- AVA中listfiles怎样查找指定文件夹中后缀名为 ".PNG", ".GIF", ".JPG"的图片
- Netty的十一个疑问
- hotcss.js如何利用sass自动生成css,快速让px转换成rem
- 在MySQL中创建实现自增的序列(Sequence)的教程
- JeeSite系列之二_Maven简介