0
点赞
收藏
分享

微信扫一扫

在spark往HDFS写string

曾宝月 2022-07-27 阅读 61


val thePath = new Path(theHdfsPath)
val hdfs = org.apache.hadoop.fs.FileSystem.get(
new java.net.URI(THE_MASTER_URI),
new org.apache.hadoop.conf.Configuration())
val writer = new PrintWriter(hdfs.create(thePath))
writer.println("toWriteString") // 或者 writer.append(toWriteString)
writer.close()


举报

相关推荐

0 条评论