如何使(Spark1.6)saveAsTextFile追加现有文件? [英] How can I make (Spark1.6) saveAsTextFile to append existing file?

查看:378
本文介绍了如何使(Spark1.6)saveAsTextFile追加现有文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在SparkSQL中,我使用DF.wirte.mode(SaveMode.Append).json(xxxx),但是此方法会像一样

In SparkSQL,I use DF.wirte.mode(SaveMode.Append).json(xxxx),but this method get these files like

文件名太复杂且随机,我不能使用api来获取.所以我想使用saveAstextfile,因为文件名不是复杂且常规的,但是我不知道如何在相同目录中追加文件?在你的时间里.

the filename is too complex and random,I can't use api to get.So I want to use saveAstextfile ,beacuse filename is not complex and regular, but I don't know how to append file in same diretory?Appreciate for your time.

推荐答案

在Spark 1.5上工作,我认为这是正确的用法.

worked on Spark 1.5 , I think this is right usage..

dataframe.write().mode(SaveMode.Append).format(FILE_FORMAT).**partitionBy**("parameter1", "parameter2").save(path);

这篇关于如何使(Spark1.6)saveAsTextFile追加现有文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆