举个例子:

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个分区,别的类同

最新文章

  1. Linux命令随笔
  2. scrollView滚动原理
  3. APP里如何添加本地文本
  4. DDD开发框架ABP之本地化/多语言支持
  5. Oracle EXP-00091的解决方法
  6. BIND_MISMATCH导致过多VERSION COUNT的问题
  7. 传感器 Sensor 加速度【示例】
  8. JavaScript typeof, null, 和 undefined
  9. HEX和BIN文件的区别
  10. Web模板
  11. c#中如何跨线程调用windows窗体控件
  12. 用户关注微信公众号后,获取该用户的openID存数据库失败
  13. 学习less
  14. request.getContextPath()
  15. h264文件分析(纯c解析代码)
  16. Bootstrap Validator使用特性,动态(Dynamic)添加的input的验证问题
  17. Numpy 基本除法运算和模运算
  18. shell中的条件判断以及与python中的对比
  19. UI自动化的痛点
  20. IE、火狐导入收藏夹乱码解决方案

热门文章

  1. Pycharm中通过扩展工具添加QTDesigner
  2. js一般用法
  3. php第二十九节课
  4. Javascript 原型链与constructor
  5. 类模板成员函数默认值问题:an out-of-line definition of a member of a class template cannot have default arguments
  6. UVA - 247 Calling Circles(Floyd求传递闭包)
  7. <SpringMvc>入门二 常用注解
  8. Java对象序列化为什么要使用SerialversionUID
  9. Poor Hanamichi
  10. nyoj 95 众数问题(set)