对RDD分区的理解
2024-10-21 06:18:04
举个例子:
val logFile = "file:///home/soyo/桌面/6.txt"
val conf = new SparkConf().setAppName("Simple Application")
val sc = new SparkContext(conf)
val RDD =sc.textFile(logFile)
RDD.saveAsTextFile("file:////home/soyo/桌面/667.txt")
val repartitionedRDD=context.repartition(8) //控制RDD分区的个数
repartitionedRDD.saveAsTextFile("file:////home/soyo/桌面/668.txt")
667.txt:
part-00000 _SUCCESS
668.txt:
part-00000 part-00001 part-00002 part-00003 part-00004 part-00005 part-00006 part-00007 _SUCCESS
如果设置.setMaster("local[2]")默认最少是2个分区,别的类同
最新文章
- Linux命令随笔
- scrollView滚动原理
- APP里如何添加本地文本
- DDD开发框架ABP之本地化/多语言支持
- Oracle EXP-00091的解决方法
- BIND_MISMATCH导致过多VERSION COUNT的问题
- 传感器 Sensor 加速度【示例】
- JavaScript typeof, null, 和 undefined
- HEX和BIN文件的区别
- Web模板
- c#中如何跨线程调用windows窗体控件
- 用户关注微信公众号后,获取该用户的openID存数据库失败
- 学习less
- request.getContextPath()
- h264文件分析(纯c解析代码)
- Bootstrap Validator使用特性,动态(Dynamic)添加的input的验证问题
- Numpy 基本除法运算和模运算
- shell中的条件判断以及与python中的对比
- UI自动化的痛点
- IE、火狐导入收藏夹乱码解决方案
热门文章
- Pycharm中通过扩展工具添加QTDesigner
- js一般用法
- php第二十九节课
- Javascript 原型链与constructor
- 类模板成员函数默认值问题:an out-of-line definition of a member of a class template cannot have default arguments
- UVA - 247 Calling Circles(Floyd求传递闭包)
- <;SpringMvc>;入门二 常用注解
- Java对象序列化为什么要使用SerialversionUID
- Poor Hanamichi
- nyoj 95 众数问题(set)