pyspark rdd 数据持久化
生活随笔
收集整理的這篇文章主要介紹了
pyspark rdd 数据持久化
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
pyspark rdd 數據持久化
from pyspark import SparkContext ,SparkConfconf=SparkConf().setAppName("miniProject").setMaster("local[4]") #conf=SparkConf().setAppName("lg").setMaster("spark://192.168.10.182:7077") sc = SparkContext(conf=conf)rdd = sc.parallelize(range(1, 4)).map(lambda x: (x, "a" * x)) rdd.saveAsSequenceFile("path/to/file") print(sorted(sc.sequenceFile("path/to/file").collect())) sc.stop() [(1, 'a'), (2, 'aa'), (3, 'aaa')]posted on 2019-03-07 22:28 luoganttcc 閱讀(...) 評論(...) 編輯 收藏
總結
以上是生活随笔為你收集整理的pyspark rdd 数据持久化的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: pyspark 通过list 构建rdd
- 下一篇: pyspark rdd 基本操作