展开

文件数据读写

最后发布时间 : 2023-08-20 13:12:12 浏览量 :

https://www.bilibili.com/video/BV1gr4y1w7zw?p=34&vd_source=b3d0a7d246fbac11e6e6396ffaf89d1b

import pyspark
from pyspark import SparkConf,SparkContext

conf  = SparkConf().setMaster('local').setAppName("my app")
sc = SparkContext(conf=conf)
textFile = sc.textFile("/home/wy/Documents/test")
textFile.first()
# ./hdfs getconf -confKey fs.defaultFS
textFile = sc.textFile("hdfs://server:8020/tmp/mapred.cmd")
textFile.first()