0
如何打開存儲在HDFS中的文件 - 此處輸入文件來自HDFS - 如果我將文件作爲波紋管,我將無法開放的,它會顯示爲找不到文件如何使用open打開存儲在pySpark中HDFS中的文件
from pyspark import SparkConf,SparkContext
conf = SparkConf()
sc = SparkContext(conf = conf)
def getMovieName():
movieNames = {}
with open ("/user/sachinkerala6174/inData/movieStat") as f:
for line in f:
fields = line.split("|")
mID = fields[0]
mName = fields[1]
movieNames[int(fields[0])] = fields[1]
return movieNames
nameDict = sc.broadcast(getMovieName())
我的假設是使用像
with open (sc.textFile("/user/sachinkerala6174/inData/movieStat")) as f:
但也沒有工作